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

            Bug ID: 79917
           Summary: Internal compiler error with variadic template and
                    concepts, internal compiler error: in
                    tsubst_constraint, at cp/constraint.cc:1956
           Product: gcc
           Version: c++-concepts
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: czirkos.zoltan at gmail dot com
  Target Milestone: ---

Created attachment 40894
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40894&action=edit
minimal working example

G++ throws an internal compiler error for the following code (attached)

G++ version: g++ (Ubuntu 7-20170303-0ubuntu2) 7.0.1 20170303 (experimental)
[trunk revision 245860].

template <typename T>
concept bool Integral() {
    return std::is_integral<T>::value;
}

template <Integral ... ARGS>
void f (ARGS ... indices)
{
}

class C {
    public:
        template <Integral ... ARGS>
        void operator() (ARGS ... indices)
        {
        }
};

int main() {
    f(0, 0);

    C obj;
    obj(0, 0);
}

The global function works correctly, the method with the same template
arguments  crashes the compiler. Output is:


gpp_bugrep.cpp: In substitution of ‘template<class ... ARGS>  requires
(Integral<ARGS>)()... void C::operator()(ARGS ...) [with ARGS = {int, int}]’:
gpp_bugrep.cpp:25:13:   required from here
gpp_bugrep.cpp:16:14: internal compiler error: in tsubst_constraint, at
cp/constraint.cc:1956
         void operator() (ARGS ... indices)
              ^~~~~~~~
0x6e8d7d tsubst_constraint(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/constraint.cc:1956
0x6e8e29 tsubst_constraint_info(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/constraint.cc:1918
0x5f6bef tsubst_decl
        ../../src/gcc/cp/pt.c:12346
0x5e33af tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13310
0x5e287b instantiate_template_1
        ../../src/gcc/cp/pt.c:18131
0x5e287b instantiate_template(tree_node*, tree_node*, int)
        ../../src/gcc/cp/pt.c:18187
0x5fb628 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../src/gcc/cp/pt.c:18567
0x5adbd7 add_template_candidate_real
        ../../src/gcc/cp/call.c:3170
0x5a5594 add_template_candidate
        ../../src/gcc/cp/call.c:3252
0x5a5594 add_candidates
        ../../src/gcc/cp/call.c:5483
0x5b0062 build_op_call_1
        ../../src/gcc/cp/call.c:4456
0x5b0062 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
        ../../src/gcc/cp/call.c:4550
0x68eba7 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../src/gcc/cp/semantics.c:2458
0x64293c cp_parser_postfix_expression
        ../../src/gcc/cp/parser.c:6991
0x64326d cp_parser_unary_expression
        ../../src/gcc/cp/parser.c:8102
0x643fd3 cp_parser_cast_expression
        ../../src/gcc/cp/parser.c:8780
0x644747 cp_parser_binary_expression
        ../../src/gcc/cp/parser.c:8881
0x644df4 cp_parser_assignment_expression
        ../../src/gcc/cp/parser.c:9168
0x647f6a cp_parser_expression
        ../../src/gcc/cp/parser.c:9337
0x64c908 cp_parser_expression_statement
        ../../src/gcc/cp/parser.c:10885

Reply via email to