You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't implement Copy for C style enums with negative discriminants that overflow into unspecified positive discriminants #23221
changed the title [-]Can't implement Copy for C style enums with negative discriminants[/-][+]Can't implement Copy for C style enums with discriminant of -1[/+]on Mar 9, 2015
@mahkoh my point is that the bug is not observed by all negative discriminants. But whatever, I'm not interested in fighting over how the title is phrased.
Activity
huonw commentedon Mar 9, 2015
Providing an explicit discriminant for the variant after the
-1works as a workaround:mahkoh commentedon Mar 9, 2015
The same happens without repr(C) or with repr(i32).
pnkfelix commentedon Mar 9, 2015
Also,
-2will work. I'll update the title.[-]Can't implement Copy for C style enums with negative discriminants[/-][+]Can't implement Copy for C style enums with discriminant of -1[/+]mahkoh commentedon Mar 9, 2015
@pnkfelix: The error message shows that it's about overflowing discriminants. There is nothing special about -1.
pnkfelix commentedon Mar 9, 2015
@mahkoh my point is that the bug is not observed by all negative discriminants. But whatever, I'm not interested in fighting over how the title is phrased.
mahkoh commentedon Mar 9, 2015
In any case the previous title was wrong because this works fine:
shepmaster commentedon Mar 9, 2015
@pnkfelix I think that @mahkoh's point was that this usage of
-2does fail:pnkfelix commentedon Mar 31, 2015
cc #23897
rollup merge of rust-lang#23863: pnkfelix/arith-oflo-const-eval