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

            Bug ID: 94207
           Summary: error: pasting "::" and "ClassFOO1" does not give a
                    valid preprocessing token
           Product: gcc
           Version: 8.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jr at heisey dot org
  Target Milestone: ---

Created attachment 48051
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48051&action=edit
Example showing error of pasting using ## operator with enum class identifiers

gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)

When referencing identifiers from an enum class in a macro and trying to scope
the enum class name using the '::' scoping operator, results in the operator
not being associated with the enum class name.


MacrosAndEnums.cpp:13:36: error: pasting "::" and "ClassFOO1" does not give a
valid preprocessing token
   mEnumClassTest[k] = EnumClassTest:: ## k;
                                    ^~
MacrosAndEnums.h:22:5: note: in expansion of macro ‘ENUM_CLASS_TEST_INIT’
     m(ClassFOO1) \
     ^
MacrosAndEnums.cpp:22:3: note: in expansion of macro ‘ENUM_CLASS_LIST’
   ENUM_CLASS_LIST(ENUM_CLASS_TEST_INIT)
   ^~~~~~~~~~~~~~~

Reply via email to