[Bug c++/126978] New: ICE in push_namespace when parsing an invalid attribute on a namespace declaration

"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=126978

            Bug ID: 126978
           Summary: ICE in push_namespace when parsing an invalid
                    attribute on a namespace declaration
           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/aerxaKcMT

Reproducer:
```
foo(auto a);

namespace[[= 42]] N
```

Backtrace:
<source>:1:12: error: expected constructor, destructor, or type conversion
before ';' token
    1 | foo(auto a);
      |            ^
<source>:3:19: internal compiler error: in push_namespace, at
cp/name-lookup.cc:9630
    3 | namespace[[= 42]] N
      |                   ^
0x2beb468 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2be00ab internal_error(char const*, ...)
        ???:0
0xb4805c fancy_abort(char const*, int, char const*)
        ???:0
0xd9e923 c_parse_file()
        ???:0
0xf31f99 c_common_parse_file()
        ???:0


This ICE goes back to gcc-16:
https://godbolt.org/z/7c9cc5G6E
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.