This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81845

--- Comment #4 from Aleksandr Slobodeniuk <alenuke at yandex dot ru> ---
> 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.

> 6 Aninteger constant expression117) shall have integer type and shall only 
> have operands that are integer constants, enumeration constants, character
> constants, sizeof expressions whose results are integer constants,
> _Alignof expressions, and floating constants that are the immediate
> operands of casts. Cast operators in an integer constant expression
> shall only convert arithmetic types to integer types, except as part of
> an operand to the sizeof or _Alignof operator.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]