diff options
-rw-r--r-- | gcc/cp/decl.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/explicit-spec1.C | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ebe1318..0df689b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -955,7 +955,9 @@ static bool function_requirements_equivalent_p (tree newfn, tree oldfn) { /* In the concepts TS, the combined constraints are compared. */ - if (cxx_dialect < cxx20) + if (cxx_dialect < cxx20 + && (DECL_TEMPLATE_SPECIALIZATION (newfn) + <= DECL_TEMPLATE_SPECIALIZATION (oldfn))) { tree ci1 = get_constraints (oldfn); tree ci2 = get_constraints (newfn); diff --git a/gcc/testsuite/g++.dg/concepts/explicit-spec1.C b/gcc/testsuite/g++.dg/concepts/explicit-spec1.C new file mode 100644 index 0000000..d9b6b3d --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/explicit-spec1.C @@ -0,0 +1,9 @@ +// PR c++/101098 +// { dg-do compile { target concepts } } + +template<typename T> concept C = __is_class(T); +struct Y { int n; } y; +template<C T> void g(T) { } +int called; +template<> void g(Y) { called = 3; } +int main() { g(y); } |