4 ms·
> C++ incompatibly requires a name for all struct and class declarations You're right about "enum class", but anonymous classes and structs are perfectly valid
by cjaybo 5y ago
> C++ incompatibly requires a name for all struct and class declarations
You're right about "enum class", but anonymous classes and structs are perfectly valid in C++:
https://godbolt.org/z/7MbcqhnoK https://godbolt.org/z/7MbcqhnoK
- dataflow 5y agoTry struct S { struct { int x; }; }; under -pedantic and you'll get warning: ISO C++ prohibits anonymous structs [-Wpedantic]
- midjji 5y agoPedantic is for the older C++ standard, its not pedantic for the latter e.g c++11, I think this changed.
- dataflow 5y agoWell that blows my mind, I never realized pedantic ignores the language setting. Is this the only case where it does that?
- junon 5y agoNo, pedantic is for disabling compiler extensions. You still need to explicitly specify a standard.
- midjji 5y agogcc pedantic ignores the language flag, and clang and intel state they mirror gcc. So pedantic would be not C++11 even if you added that.