[Bug c++/126840] New: ICE on invalid alignas() declaration with empty attribute argument

"s.kimura.h41104 at gmail dot com via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126840

            Bug ID: 126840
           Summary: ICE on invalid alignas() declaration with empty
                    attribute argument
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s.kimura.h41104 at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/WhT65o86v

Reproducer:
```
int foo() {
  alignas() {}
  return 0;
}
```

Backtrace:
<source>:2:11: error: expected primary-expression before ')' token
    2 |   alignas() {}
      |           ^
<source>:3:10: internal compiler error: tree check: expected tree_list, have
error_mark in get_attribute_name, at attribs.cc:1062
    3 |   return 0;
      |          ^
0x2bae358 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2ba2f9b internal_error(char const*, ...)
        ???:0
0xa3bc74 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xd98493 c_parse_file()
        ???:0
0xf2b969 c_common_parse_file()
        ???:0


This ICE goes back to gcc-15:
https://godbolt.org/z/nEKnx5TPc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.