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

            Bug ID: 71221
           Summary: [concepts] ICE in tsubst_pack_expansion when expanding
                    a sizeof... expression in a requires clause of a
                    member function template
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tom at honermann dot net
                CC: andrew.n.sutton at gmail dot com, asutton at gcc dot gnu.org
  Target Milestone: ---

The following test case demonstrates an internal compiler error that occurs
with gcc 7.0.0 (r236423) when expanding a sizeof... expression in a requires
clause of a member function template.

$ cat t.cpp
template<int... Is>
struct int_sequence {};
template<int N>
struct S {
    template <int... Is>
    requires sizeof...(Is) == N
    int mf1(int_sequence<Is...>);
    void mf2() {
        mf1(int_sequence<>{});
    }
};

$ svn info
Path: .
Working Copy Root Path: /home/tom/src/gcc-trunk
URL: svn://gcc.gnu.org/svn/gcc/trunk
Relative URL: ^/trunk
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 236427
Node Kind: directory
Schedule: normal
Last Changed Author: uros
Last Changed Rev: 236423
Last Changed Date: 2016-05-18 15:15:22 -0400 (Wed, 18 May 2016)

$ g++ --version
g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
...

$ g++ -c -std=c++1z -fconcepts t.cpp
t.cpp: In member function ‘void S<N>::mf2()’:
t.cpp:6:20: internal compiler error: in tsubst_pack_expansion, at cp/pt.c:10967
     requires sizeof...(Is) == N
                    ^~~
0x6c758f tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-trunk/gcc/cp/pt.c:10967
0x6b190b tsubst_copy
        ../../gcc-trunk/gcc/cp/pt.c:14131
0x6b525a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc-trunk/gcc/cp/pt.c:17161
0x6b4beb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc-trunk/gcc/cp/pt.c:16176
0x6a99ee tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-trunk/gcc/cp/pt.c:15800
0x889a67 satisfy_predicate_constraint
        ../../gcc-trunk/gcc/cp/constraint.cc:1768
0x889a67 satisfy_constraint_1
        ../../gcc-trunk/gcc/cp/constraint.cc:1975
0x88a866 satisfy_constraint
        ../../gcc-trunk/gcc/cp/constraint.cc:2026
0x88a9bc constraints_satisfied_p(tree_node*)
        ../../gcc-trunk/gcc/cp/constraint.cc:2133
0x64807c add_function_candidate
        ../../gcc-trunk/gcc/cp/call.c:2013
0x648d9c add_template_candidate_real
        ../../gcc-trunk/gcc/cp/call.c:3146
0x649693 add_template_candidate
        ../../gcc-trunk/gcc/cp/call.c:3188
0x649693 add_candidates
        ../../gcc-trunk/gcc/cp/call.c:5361
0x649f2f build_new_method_call_1
        ../../gcc-trunk/gcc/cp/call.c:8313
0x649f2f build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc-trunk/gcc/cp/call.c:8512
0x7610f2 cp_parser_postfix_expression
        ../../gcc-trunk/gcc/cp/parser.c:6875
0x75ebdc cp_parser_unary_expression
        ../../gcc-trunk/gcc/cp/parser.c:7986
0x768db7 cp_parser_cast_expression
        ../../gcc-trunk/gcc/cp/parser.c:8663
0x7693a3 cp_parser_binary_expression
        ../../gcc-trunk/gcc/cp/parser.c:8764
0x769c94 cp_parser_assignment_expression
        ../../gcc-trunk/gcc/cp/parser.c:9051
...

Reply via email to