aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-07-23 22:50:16 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-07-23 22:50:16 -0400
commit71b3723abb23b848ed7a647506345cdfaa03fddb (patch)
treedf9e52326934398d3116fd42f3d4dfffdb4401f8 /gcc
parent6970223f93ce9102cd95044f7c4d10a4ce695a77 (diff)
downloadgcc-71b3723abb23b848ed7a647506345cdfaa03fddb.zip
gcc-71b3723abb23b848ed7a647506345cdfaa03fddb.tar.gz
gcc-71b3723abb23b848ed7a647506345cdfaa03fddb.tar.bz2
PR c++/70778 - member template template parameter
* pt.c (tsubst): Also substitute into the template of a BOUND_TEMPLATE_TEMPLATE_PARM. From-SVN: r238686
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c11
-rw-r--r--gcc/testsuite/g++.dg/template/ttp29.C21
3 files changed, 34 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c9a28ae..e5275f5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2016-07-23 Jason Merrill <jason@redhat.com>
+ PR c++/70778
+ * pt.c (tsubst): Also substitute into the template of a
+ BOUND_TEMPLATE_TEMPLATE_PARM.
+
PR c++/71738
* pt.c (lookup_template_class_1): Handle getting template from tsubst.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a44bead..65fa982 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13232,13 +13232,20 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (code == BOUND_TEMPLATE_TEMPLATE_PARM)
{
- tree argvec = tsubst (TYPE_TI_ARGS (t), args,
+ tree tinfo = TYPE_TEMPLATE_INFO (t);
+ /* We might need to substitute into the types of non-type
+ template parameters. */
+ tree tmpl = tsubst (TI_TEMPLATE (tinfo), args,
+ complain, in_decl);
+ if (tmpl == error_mark_node)
+ return error_mark_node;
+ tree argvec = tsubst (TI_ARGS (tinfo), args,
complain, in_decl);
if (argvec == error_mark_node)
return error_mark_node;
TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (r)
- = build_template_info (TYPE_TI_TEMPLATE (t), argvec);
+ = build_template_info (tmpl, argvec);
}
}
break;
diff --git a/gcc/testsuite/g++.dg/template/ttp29.C b/gcc/testsuite/g++.dg/template/ttp29.C
new file mode 100644
index 0000000..7d4e03a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ttp29.C
@@ -0,0 +1,21 @@
+// PR c++/70778
+
+template <class KeyType>
+struct Stuff
+{
+ template <KeyType, class>
+ struct AddToFront;
+
+ template <KeyType ToAdd, template<KeyType> class Holder, KeyType Indexs>
+ struct AddToFront<ToAdd, Holder<Indexs> >
+ {
+ };
+};
+
+template <unsigned>
+struct Holder {};
+
+int main()
+{
+ Stuff<unsigned>::AddToFront<0, Holder<24> > t;
+}