[Bug c/81845] const union's field doesn't interpret as const in switch/case

2017-08-16 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81845 --- Comment #6 from Jonathan Wakely --- (In reply to Aleksandr Slobodeniuk from comment #0) > What's funny is that I didn't find any compiler, that could compile it. That usually means it's not a bug then.

[Bug c/81845] const union's field doesn't interpret as const in switch/case

2017-08-16 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81845 --- Comment #5 from Jonathan Wakely --- (In reply to Aleksandr Slobodeniuk from comment #3) > Fields of const-qualified structs and unions, that were initialized with > const literals ARE *constant expressions*, isn't it? No. See 6.6 p6

[Bug c/81845] const union's field doesn't interpret as const in switch/case

2017-08-16 Thread alenuke at yandex dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81845 --- Comment #4 from Aleksandr Slobodeniuk --- > Fields of const-qualified structs and unions, that were initialized with > const literals ARE *constant expressions*, isn't it? Maybe that's the answer: C11 standard. 6.6 Constant expressions. >

[Bug c/81845] const union's field doesn't interpret as const in switch/case

2017-08-16 Thread alenuke at yandex dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81845 --- Comment #3 from Aleksandr Slobodeniuk --- (In reply to Richard Biener from comment #1) > it has to be a constant literal. Sorry, I didn't really specify the standard (and mess c with c++). C11 standard. 6.8.4.2 The switch statement. > 3

[Bug c/81845] const union's field doesn't interpret as const in switch/case

2017-08-16 Thread alenuke at yandex dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81845 --- Comment #2 from Aleksandr Slobodeniuk --- Sorry, I didn't really specify the standard (and mess c with c++). C11 standard. 6.8.4.2 The switch statement. > 3 The expression of each case label shall be an integer constant expression > and no

[Bug c/81845] const union's field doesn't interpret as const in switch/case

2017-08-16 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81845 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---