https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97034
Bug ID: 97034 Summary: ICE on C++20 code: gcc_assert failure in return type deduction (gcc/cp/pt.c:26984 in type_dependent_expression_p(tree_node*)) Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dimitri.gorokhovik at free dot fr Target Milestone: --- The code: #include <tuple> template <unsigned N> struct s { template <typename R> struct ss { R _1; unsigned _2; }; constexpr auto f () { return ss { std::pair <char, int> { 'a', 1 }, 1 }; }; }; when compiled as: g++ -std=c++20 -o bug-3.o -c bug-3.cpp produces: bug-3.cpp: In member function ‘constexpr auto s<N>::f()’: bug-3.cpp:15:65: internal compiler error: in type_dependent_expression_p, at cp/pt.c:26984 15 | return ss { std::pair <char, int> { 'a', 1 }, 1 }; | ^ 0x680638 type_dependent_expression_p(tree_node*) ../../src/gcc/cp/pt.c:26984 0xa22cf9 maybe_instantiate_noexcept(tree_node*, int) ../../src/gcc/cp/pt.c:25290 0x9598c2 mark_used(tree_node*, int) ../../src/gcc/cp/decl2.c:5552 0xaa8d36 cp_build_addr_expr_1 ../../src/gcc/cp/typeck.c:6384 0x8ab692 build_over_call ../../src/gcc/cp/call.c:8522 0x8ae85a build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../src/gcc/cp/call.c:4641 0xa1a4ed do_class_deduction ../../src/gcc/cp/pt.c:29027 0xa1a4ed do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*, int) ../../src/gcc/cp/pt.c:29085 0xa6def9 finish_compound_literal(tree_node*, tree_node*, int, fcl_t) ../../src/gcc/cp/semantics.c:2934 0x9ca12a cp_parser_functional_cast ../../src/gcc/cp/parser.c:29690 0x9e26d7 cp_parser_postfix_expression ../../src/gcc/cp/parser.c:7251 0x9c443a cp_parser_binary_expression ../../src/gcc/cp/parser.c:9648 0x9c61ce cp_parser_assignment_expression ../../src/gcc/cp/parser.c:9953 0x9c64e2 cp_parser_expression ../../src/gcc/cp/parser.c:10121 0x9d5527 cp_parser_jump_statement ../../src/gcc/cp/parser.c:13192 0x9d5527 cp_parser_statement ../../src/gcc/cp/parser.c:11455 0x9d6a8d cp_parser_statement_seq_opt ../../src/gcc/cp/parser.c:11928 0x9d6b68 cp_parser_compound_statement ../../src/gcc/cp/parser.c:11878 0x9eecb5 cp_parser_function_body ../../src/gcc/cp/parser.c:23177 0x9eecb5 cp_parser_ctor_initializer_opt_and_function_body ../../src/gcc/cp/parser.c:23228 Please submit a full bug report, GCC version: g++ (GCC) 11.0.0 20200910 (experimental)