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

            Bug ID: 124302
           Summary: ICE in xref_basetypes, at cp/decl.cc:18541
           Product: gcc
           Version: 16.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: ---

Code:
template <struct a union a {} union a {

Command:
g++ -c test.cpp

Backtrace:

<source>:1:37: internal compiler error: in xref_basetypes, at cp/decl.cc:18541
    1 | template <struct a union a {} union a {
      |                                     ^
0x2963338 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x295807b internal_error(char const*, ...)
        ???:0
0xb21a12 fancy_abort(char const*, int, char const*)
        ???:0
0xd6d023 c_parse_file()
        ???:0
0xef6ef9 c_common_parse_file()
        ???:0
/cefs/5b/5b7473000a337cbbdec6c161_gcc-trunk-20260226/bin/../libexec/gcc/x86_64-linux-gnu/16.0.1/cc1plus
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/5b/5b7473000a337cbbdec6c161_gcc-trunk-20260226/bin/../lib/gcc/x86_64-linux-gnu/16.0.1/
-D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext
.cpp -masm=intel -mtune=generic -march=x86-64 -g -fdiagnostics-color=always
-fno-verbose-asm -o /app/output.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

See Compiler Explorer: https://godbolt.org/z/Y7nzoedW3

This only occurs in GCC-trunk, and this also makes released GCC "confused by
earlier errors, bailing out".

The test case was generated by a fuzzer.

Reply via email to