Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
mcc
mcc
@mcc@mastodon.social  ·  activity timestamp 17 hours ago

Having a C++ hell problem.

There's a namespace named "vendor", containing a class named "ClassName", containing an enum "EnumName", containing a value named "Success".

There's code that compiles on Windows with MSVC and on MacOS with Clang. But on Linux with GCC, it fails; if I say vendor::ClassName::Success it says "expected unqualified-id before numeric constant" on Success and if I say "vendor::ClassName::EnumName::Success" it says "expected unqualified-id before 'int'" on EnumName.

(1/2)

gcc output as described
gcc output as described
gcc output as described
  • Copy link
  • Flag this post
  • Block
mcc
mcc
@mcc@mastodon.social replied  ·  activity timestamp 17 hours ago

set(CMAKE_CXX_STANDARD 17) is set in CMake. Oh, and I believe this same code compiled on GCC before, implying something changed with headers or header order.

My questions, I think, are:

1. This smells to me like a #define somewhere doing something weird. Does it smell like that to you too, or could something else be happening?

2. Can I induce CMake to spit out the gcc -E output so I can see what the preprocessor is turning this code into?

(2/2)

  • Copy link
  • Flag this comment
  • Block
mcc
mcc
@mcc@mastodon.social replied  ·  activity timestamp 17 hours ago

Oh for heck's sake.

#undef Status
#undef Success

This at the top of the file fixes the problem. I'm in #define hell and I don't know why. :(

  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct