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

            Bug ID: 124299
           Summary: Accepts invalid alignas on enum class
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: suyuchang at whu dot edu.cn
  Target Milestone: ---

The code applies alignas to an enumeration declaration. Clang rejects it. GCC
accepts it.

Code:
enum class alignas ( char32_t ) X0 ;

Command:
clang++ test.cpp

<source>:1:12: error: 'alignas' attribute cannot be applied to an enumeration
    1 | enum class alignas ( char32_t ) X0 ;
      |            ^
1 error generated.

See Compiler Explorer: https://godbolt.org/z/31GKanenf

The test case was generated by a fuzzer.

Reply via email to