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

            Bug ID: 65635
           Summary: [c++-concepts] ICE in cp_tree_equal() during class
                    template partial specialization constraint matching
           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

Encountered with the latest revision of the gcc c++-concepts branch (r221742).

An internal compiler error occurs when matching constrained class template
partial specializations.

$ svn info   # From my local svn gcc repo.
Path: .
URL: svn://gcc.gnu.org/svn/gcc/branches/c++-concepts
Repository Root: svn://gcc.gnu.org/svn/gcc
Repository UUID: 138bc75d-0d04-0410-961f-82ee72b054a4
Revision: 221742
Node Kind: directory
Schedule: normal
Last Changed Author: asutton
Last Changed Rev: 221733
Last Changed Date: 2015-03-27 10:44:22 -0400 (Fri, 27 Mar 2015)

$ cat t.cpp
template<typename T>
concept bool Subsumed() {
    return requires () { typename T::type1; };
}

template<typename T>
concept bool Subsuming() {
    return Subsumed<T>()
        && requires () { typename T::type2; };
}

struct M {
    using type1 = int;
    using type2 = int;
};

template<typename T>
concept bool C() {
    return requires () {
               typename T::force_instantiation;
           };
}

template<typename T>
struct TM;
template<Subsumed T>
struct TM<T> {};
template<Subsuming T>
struct TM<T> {};

static_assert(C<TM<M>>(), "");

$ g++ -c -std=c++1z t.cpp 
t.cpp:20:28: internal compiler error: in cp_tree_equal, at cp/tree.c:3037
                typename T::force_instantiation;
                            ^
0x7c7a6f cp_tree_equal(tree_node*, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/tree.c:3037
0x7c7a0e cp_tree_equal(tree_node*, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/tree.c:3028
0x82f7d2 match_terms
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/logic.cc:384
0x82f7d2 subsumes_atomic_constraint
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/logic.cc:394
0x82f7d2 subsumes_constraint
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/logic.cc:445
0x82f94f subsumes_conjunction
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/logic.cc:406
0x82f94f subsumes_constraint
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/logic.cc:439
0x82faee subsumes_constraints_nonnull
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/logic.cc:463
0x82faee subsumes(tree_node*, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/logic.cc:481
0x82f554 more_constrained(tree_node*, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:2089
0x6899dd most_specialized_partial_spec
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:20019
0x6afb0c instantiate_class_template_1
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:9634
0x6afb0c instantiate_class_template(tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:10174
0x74f2cb complete_type(tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/typeck.c:146
0x68bc7d tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:13001
0x67574b tsubst_decl
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:11807
0x68b9c6 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/pt.c:12388
0x82eb81 tsubst_type_requirement
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:1390
0x82eb81 tsubst_requirement
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:1426
0x82eb81 tsubst_requirement_body
        ../../gcc-c++-concepts2/c++-concepts/gcc/cp/constraint.cc:1446

Reply via email to