diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/pt.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5.C | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5a.C | 15 |
4 files changed, 32 insertions, 10 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7e56ccf..dc0f0b7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10728,15 +10728,11 @@ any_template_parm_r (tree t, void *data) break; case TEMPLATE_DECL: - { - /* If T is a member template that shares template parameters with - ctx_parms, we need to mark all those parameters for mapping. */ - if (tree ctmpl = TREE_TYPE (INNERMOST_TEMPLATE_PARMS (ftpi->ctx_parms))) - if (tree com = common_enclosing_class (DECL_CONTEXT (t), - DECL_CONTEXT (ctmpl))) - if (tree ti = CLASSTYPE_TEMPLATE_INFO (com)) - WALK_SUBTREE (TI_ARGS (ti)); - } + /* If T is a member template that shares template parameters with + ctx_parms, we need to mark all those parameters for mapping. + To that end, it should suffice to just walk the DECL_CONTEXT of + the template (assuming the template is not overly general). */ + WALK_SUBTREE (DECL_CONTEXT (t)); break; case LAMBDA_EXPR: diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C index 625149e..f990ae1 100644 --- a/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl4.C @@ -24,5 +24,5 @@ int main() { A<void>::B::f(0); A<void>::C<int>::f(0); - // A<void>::C<int>::g(); + A<void>::C<int>::g(); } diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5.C b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5.C new file mode 100644 index 0000000..3c83bb8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5.C @@ -0,0 +1,11 @@ +// PR c++/101247 +// { dg-do compile { target concepts } } + +template<class T, class U> struct A { + template<class> static constexpr bool d = true; + static void g() requires d<U>; +}; + +int main() { + A<int, char>::g(); +} diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5a.C b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5a.C new file mode 100644 index 0000000..458f1cd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-memtmpl5a.C @@ -0,0 +1,15 @@ +// PR c++/101247 +// { dg-do compile { target concepts } } +// A variant of concepts-memtmpl5.C that uses a partial specialization +// of A instead of the primary template. + +template<class, class> struct A; + +template<class T, class U> requires true struct A<T, U> { + template<class V> static constexpr bool d = true; + static void g() requires d<U>; +}; + +int main() { + A<int, char>::g(); +} |