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

            Bug ID: 98810
           Summary: [C++20] ICE in tsubst_copy, at cp/pt.c:16771
           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:

template <auto> struct a {};
template <int i, const a <i> s = a <i> {}> using b = a <s>;
template <int i> constexpr auto g (const b <i> &) { return true; };

compiled with 'g++ -std=c++20 -c bug-13.cpp'  (g++ (GCC) 11.0.0 20210123
(experimental)), produces:

ug-13.cpp: In substitution of ‘template<int i, a<i> s> using b = a<((const
a<i>)s)> [with int i = i; a<i> s = a<i>{}]’:
bug-13.cpp:4:46:   required from here
bug-13.cpp:3:57: internal compiler error: in tsubst_copy, at cp/pt.c:16771
    3 | template <int i, const a <i> s = a <i> {}> using b = a <s>;
      |                                                         ^
0x6cb940 tsubst_copy
        ../../src/gcc/cp/pt.c:16771
0xac3c42 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:20766
0xacee68 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.c:19019
0xae1a4e tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13322
0xaecf83 tsubst_aggr_type
        ../../src/gcc/cp/pt.c:13525
0xacbed0 tsubst_decl
        ../../src/gcc/cp/pt.c:14763
0xade475 instantiate_template_1
        ../../src/gcc/cp/pt.c:21016
0xadf76f instantiate_template(tree_node*, tree_node*, int)
        ../../src/gcc/cp/pt.c:21075
0xadf76f instantiate_alias_template
        ../../src/gcc/cp/pt.c:21113
0xadf76f tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:15394
0xaeb4ff lookup_template_class_1
        ../../src/gcc/cp/pt.c:9937
0xaec8dc lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../src/gcc/cp/pt.c:10226
0xb1431b finish_template_type(tree_node*, tree_node*, int)
        ../../src/gcc/cp/semantics.c:3464
0xa87531 cp_parser_template_id
        ../../src/gcc/cp/parser.c:17406
0xa8771b cp_parser_class_name
        ../../src/gcc/cp/parser.c:24631
0xa7ecba cp_parser_qualifying_entity
        ../../src/gcc/cp/parser.c:6994
0xa7ecba cp_parser_nested_name_specifier_opt
        ../../src/gcc/cp/parser.c:6676
0xa94234 cp_parser_simple_type_specifier
        ../../src/gcc/cp/parser.c:18799
0xa7332d cp_parser_type_specifier
        ../../src/gcc/cp/parser.c:18457
0xa74329 cp_parser_decl_specifier_seq
        ../../src/gcc/cp/parser.c:15003
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to