gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Error when evaluating an enum discriminant containing arithmetic operations

Open sakupan102 opened this issue 9 months ago • 1 comments

Summary

An error occurs when evaluating an enum discriminant containing arithmetic operations.

Reproducer

I tried this code:

enum Foo {
    Bar = 3 + 12,
}

fn main() {
    let x = Foo::Bar;
}

Does the code make use of any (1.49) nightly feature ?

  • [ ] Nightly

Godbolt link

No response

Actual behavior

crab1: error: the value of 'RUSTTMP.1' is not usable in a constant expression

Expected behavior

success

GCC Version

gccrs version: b79c452e07c

sakupan102 avatar Mar 29 '25 13:03 sakupan102

Could you assign this issue to me?

sakupan102 avatar Mar 29 '25 13:03 sakupan102