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

            Bug ID: 117551
           Summary: ICE on x86_64-linux-gnu: in
                    cp_parser_decomposition_declaration, at
                    cp/parser.cc:16446.
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

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

*******************************************************************************
gcc version:
Using built-in specs.
COLLECT_GCC=/home/software/gcc-trunk/bin/gcc
COLLECT_LTO_WRAPPER=/home/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --disable-bootstrap --enable-checking=yes
--prefix=/home/software/gcc-trunk --enable-sanitizers --enable-languages=c,c++
--disable-werror --enable-multilib --enable-coverage
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241107 (experimental) (GCC)

*******************************************************************************
Program:
$ cat mutant.C
template <typename> void f () {
  int{[](auto u) -> decltype(({ auto [x0] = u; })) {}};
}

*******************************************************************************
Command Lines:
$ gcc mutant.C
mutant.C: In function 'void f()':
mutant.C:2:41: internal compiler error: in cp_parser_decomposition_declaration,
at cp/parser.cc:16446
    2 |   int{[](auto u) -> decltype(({ auto [x0] = u; })) {}};
      |                                         ^
0x5cdf4f4 internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:518
0x5c807b6 fancy_abort(char const*, int, char const*)
        ../../gcc/gcc/diagnostic.cc:1696
0x1366311 cp_parser_decomposition_declaration
        ../../gcc/gcc/cp/parser.cc:16446
0x136480d cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.cc:16089
0x1364376 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.cc:15984
0x13603d8 cp_parser_declaration_statement
        ../../gcc/gcc/cp/parser.cc:15081
0x13566fc cp_parser_statement
        ../../gcc/gcc/cp/parser.cc:12967
0x1358acd cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.cc:13508
0x13582cc cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.cc:13355
0x13358b3 cp_parser_statement_expr
        ../../gcc/gcc/cp/parser.cc:5522
0x1337254 cp_parser_primary_expression
        ../../gcc/gcc/cp/parser.cc:5944
0x1340232 cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.cc:7977
0x1369b0f cp_parser_decltype_expr
        ../../gcc/gcc/cp/parser.cc:17390
0x136a0c6 cp_parser_decltype
        ../../gcc/gcc/cp/parser.cc:17515
0x1374f7f cp_parser_simple_type_specifier
        ../../gcc/gcc/cp/parser.cc:20638
0x1373e57 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.cc:20404
0x1388e48 cp_parser_type_specifier_seq
        ../../gcc/gcc/cp/parser.cc:25475
0x13881c5 cp_parser_type_id_1
        ../../gcc/gcc/cp/parser.cc:25272
0x1388b6b cp_parser_trailing_type_id
        ../../gcc/gcc/cp/parser.cc:25398
0x13523fc cp_parser_lambda_declarator_opt
        ../../gcc/gcc/cp/parser.cc:12112
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.

However, clang accepts this code.

Reply via email to