aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-03-26 23:54:22 -0400
committerJason Merrill <jason@redhat.com>2022-03-28 09:35:58 -0400
commitb854ce130ebbfdf2f882ef08538746030513b44b (patch)
tree014b61026e6fa7636eee1eedc7f30deb230550f2 /gcc/cp
parentc7361eb36fa50307c9f7cfca36c9f58ce24f8f54 (diff)
downloadgcc-b854ce130ebbfdf2f882ef08538746030513b44b.zip
gcc-b854ce130ebbfdf2f882ef08538746030513b44b.tar.gz
gcc-b854ce130ebbfdf2f882ef08538746030513b44b.tar.bz2
c++: CTAD and member alias template [PR102123]
When building a deduction guide from the Test constructor, we need to rewrite the use of _dummy into a dependent reference, i.e. Test<T>::template _dummy. We were using SCOPE_REF for both type and non-type templates; we need to use UNBOUND_CLASS_TEMPLATE for type templates. PR c++/102123 gcc/cp/ChangeLog: * pt.cc (tsubst_copy): Use make_unbound_class_template for rewriting a type template reference. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction110.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 41f1ef1..678063f 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -17021,6 +17021,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/* When rewriting a constructor into a deduction guide, a
non-dependent name can become dependent, so memtmpl<args>
becomes context::template memtmpl<args>. */
+ if (DECL_TYPE_TEMPLATE_P (t))
+ return make_unbound_class_template (context, DECL_NAME (t),
+ NULL_TREE, complain);
tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
return build_qualified_name (type, context, DECL_NAME (t),
/*template*/true);