diff options
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/tree.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/canon-type-14.C | 8 |
4 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 45c422f5950..9533cca7137 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2020-04-18 Patrick Palka <ppalka@redhat.com> + PR c++/94632 + * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore + comparing_specializations if the parameters' contexts are identical. + PR c++/92187 * pt.c (splice_late_return_type): Propagate cv-qualifiers and PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8e4934c0009..dc4f1f48d3c 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3723,11 +3723,12 @@ cp_tree_equal (tree t1, tree t2) up for expressions that involve 'this' in a member function template. */ - if (comparing_specializations && !CONSTRAINT_VAR_P (t1)) + if (comparing_specializations + && DECL_CONTEXT (t1) != DECL_CONTEXT (t2)) /* When comparing hash table entries, only an exact match is good enough; we don't want to replace 'this' with the version from another function. But be more flexible - with local parameters in a requires-expression. */ + with parameters with identical contexts. */ return false; if (same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 08bef53e911..a41cc03f6fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2020-04-18 Patrick Palka <ppalka@redhat.com> + PR c++/94632 + * g++.dg/template/canon-type-14.C: New test. + PR c++/92187 * g++.dg/concepts/abbrev5.C: New test. * g++.dg/concepts/abbrev6.C: New test. diff --git a/gcc/testsuite/g++.dg/template/canon-type-14.C b/gcc/testsuite/g++.dg/template/canon-type-14.C new file mode 100644 index 00000000000..fa05bdb9a74 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/canon-type-14.C @@ -0,0 +1,8 @@ +// PR c++/94632 +// { dg-do compile { target c++11 } } + +template <bool> struct b; +template <typename> class c { + template <typename f> static void d(f e, b<decltype(e)::k>); +}; +template class c<int>; |