mcc,
@mcc@mastodon.social avatar

I still don't understand why, with C++14, gcc is banning me from having a struct field with the same name as its type*, but clang and msvc both appear to be allowing this. I'm used to msvc disagreeing with clang/gcc, i'm not used to clang and msvc agreeing on something and gcc being the odd one out.

  • e.g.:

enum Abc { A, B, C };
struct Test { Abc Abc; };
int main() { return 3; }

tess,
@tess@mastodon.social avatar

@mcc my experience with gcc vs other compilers is that if the spec doesn't explicitly define a behavior, gcc will at best error and at worst manifest unpredictable results at runtime; msvc will just do what you meant with no argument; and clang will fall somewhere in the middle (but probably err on the side of a warning or error).

mcc,
@mcc@mastodon.social avatar

Hmm okay so this thread https://cplusplus.com/forum/general/171799/

Explains I can make it work by putting a :: before Abc in the typename. Is there something I could put in my CMakeLists to make gcc just chill out about the friggin typenames, though?

pokeylope,
@pokeylope@mastodon.social avatar

@mcc gcc allows it with the -fms-extensions option

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • rosin
  • osvaldo12
  • thenastyranch
  • DreamBathrooms
  • khanakhh
  • magazineikmin
  • InstantRegret
  • Youngstown
  • slotface
  • mdbf
  • love
  • kavyap
  • GTA5RPClips
  • everett
  • anitta
  • cubers
  • ethstaker
  • Durango
  • ngwrru68w68
  • tacticalgear
  • modclub
  • cisconetworking
  • Leos
  • provamag3
  • normalnudes
  • tester
  • megavids
  • JUstTest
  • All magazines