aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-07-09 13:50:01 -0400
committerJason Merrill <jason@redhat.com>2021-07-09 16:11:48 -0400
commitddd25bd1a7c8f456bc914e34b77d43f39a1062d4 (patch)
treeaf8f3ede0050bbaf3ae25927c5504c3f1891ff88 /gcc/cp/decl.c
parentd5b1bb0d197f9141a0f0e510f8d1b598c3df9552 (diff)
downloadgcc-ddd25bd1a7c8f456bc914e34b77d43f39a1062d4.zip
gcc-ddd25bd1a7c8f456bc914e34b77d43f39a1062d4.tar.gz
gcc-ddd25bd1a7c8f456bc914e34b77d43f39a1062d4.tar.bz2
c++: concepts TS and explicit specialization [PR101098]
duplicate_decls was not recognizing the explicit specialization as matching the implicit specialization of g<Y> because function_requirements_equivalent_p was seeing the C constraint on the implicit one and not on the explicit. PR c++/101098 gcc/cp/ChangeLog: * decl.c (function_requirements_equivalent_p): Only compare trailing requirements on a specialization. gcc/testsuite/ChangeLog: * g++.dg/concepts/explicit-spec1.C: New test.
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c4
1 files changed, 3 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);