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

            Bug ID: 87181
           Summary: ICE with _Pragma push_macro
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel at hebirobotics dot com
  Target Milestone: ---

Similar to #69665, I am getting an ICE when trying to push the builtin
`__LINE__` macro. I've tested various versions of GCC from 5.2 up until GCC 9
(which I am assuming is still in beta?).

The output error is:

`internal compiler error: invalid hash type 1 in cpp_macro_definition`

All GCC compilers I have tested this on target x86_64 (x86_64-redhat-linux).

You can reproduce this with a single line of code such as:
#pragma push_macro("__LINE__")
or
_Pragma("push_macro(\"__LINE__\")

or even just the following in bash:
g++ -x c++ - -c -o /dev/null <<< "#pragma push_macro(\"__LINE__\")"




I have tried passing different flags to `g++` when attempting to compile, but
nothing has produced different results.

Here is a simple snippet of code on godbolt.org which shows that many other
commonly used compilers will compile with this used:
https://gcc.godbolt.org/z/bv2-rY

While I understand this is probably UB per any ISO C++, it was my assumption
that gcc would not be the only compiler to fail to build the source file.

Reply via email to