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

            Bug ID: 71930
           Summary: g++ invokes the wrong preprocessor
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: noloader at gmail dot com
  Target Milestone: ---

I don't believe this is expected behavior, especially since (1) g++ is being
used, and (2) -std=c++17 is being used.

$ /opt/local/bin/g++ -std=c++17 -dM -E - </dev/null | grep __cplusplus
cc1: warning: command line option '-std=c++1z' is valid for C++/ObjC++ but not
for C

And:

$ /opt/local/bin/g++ --version
g++-mp-6 (MacPorts gcc6 6.1.0_0) 6.1.0

Force including a C++ header resulted in an error:

$ /opt/local/bin/g++ -std=c++17 -include string -dM -E - </dev/null | grep
__cplusplus
cc1: warning: command line option '-std=c++1z' is valid for C++/ObjC++ but not
for C
cc1: fatal error: string: No such file or directory

It seems like if the right preprocessor were used, I could get GCC to give me
the value of __cplusplus without a lot of aggravations.

Reply via email to