aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/pt.cc20
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/lambda-targ15.C17
2 files changed, 30 insertions, 7 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index e8d342f..26ed9de 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -17181,18 +17181,24 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case UNBOUND_CLASS_TEMPLATE:
{
- ++processing_template_decl;
- tree ctx = tsubst_entering_scope (TYPE_CONTEXT (t), args,
- complain, in_decl);
- --processing_template_decl;
tree name = TYPE_IDENTIFIER (t);
+ if (name == error_mark_node)
+ return error_mark_node;
+
tree parm_list = DECL_TEMPLATE_PARMS (TYPE_NAME (t));
+ parm_list = tsubst_template_parms (parm_list, args, complain);
+ if (parm_list == error_mark_node)
+ return error_mark_node;
- if (ctx == error_mark_node || name == error_mark_node)
+ if (parm_list && TMPL_PARMS_DEPTH (parm_list) > 1)
+ ++processing_template_decl;
+ tree ctx = tsubst_entering_scope (TYPE_CONTEXT (t), args,
+ complain, in_decl);
+ if (parm_list && TMPL_PARMS_DEPTH (parm_list) > 1)
+ --processing_template_decl;
+ if (ctx == error_mark_node)
return error_mark_node;
- if (parm_list)
- parm_list = tsubst_template_parms (parm_list, args, complain);
return make_unbound_class_template (ctx, name, parm_list, complain);
}
diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-targ15.C b/gcc/testsuite/g++.dg/cpp2a/lambda-targ15.C
new file mode 100644
index 0000000..90160a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/lambda-targ15.C
@@ -0,0 +1,17 @@
+// PR c++/119981
+// { dg-do compile { target c++20 } }
+
+template<template<class> class P>
+struct mp_copy_if{};
+
+template<auto Fn>
+struct g {
+ template<class> struct fn{};
+};
+
+template<typename>
+void test3() {
+ mp_copy_if<g<[]{}>::template fn> b;
+}
+
+template void test3<int>();