This concerns GCC 6.1.1 running on Arch Linux amd64. The following code will produce a warning if compiled with -Wpedantic:
enum { TEST = 1 << 31 };
The warning is:
warning: enumerator value for ‘TEST’ is not an integer constant expression [-Wpedantic]
But if I instead write
enum { TEST = 1 << 30 };
There is no warning.
This is unforunate since e.g. the glib/gio headers contain such enums, so they will add warnings to the compile if using -Wpedantic.
I don't feel that this warning is motivated. According to the C11 standard (final draft, page 106), an integer constant expression "shall have integer type and shall only have operands that are integer constants", which by my understanding this expression satisfies.
Thanks for you attention,
Johan

1 << 31
is not a constant integral expression in C99/C90/C11 since you are overflowing the 1 to the sign bit. If you want 1 << 31, then you can use "(int)(1u << 31)" or if you want unsigned then you can just do 1u << 31.