From bf4c0738c0a3f8984feae12e7ef89f05793a35c9 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 16 Nov 2010 20:43:02 -0500 Subject: [PATCH] DR 1004 DR 1004 * decl.c (make_unbound_class_template): Handle using injected-type-name as template. From-SVN: r166850 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 3 +++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/template/injected2.C | 9 +++++++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/injected2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cdbec790eef..e32c3b7e877 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-11-16 Jason Merrill + + DR 1004 + * decl.c (make_unbound_class_template): Handle using + injected-type-name as template. + 2010-11-15 Nicola Pero * typeck.c (cp_build_unary_op): Use diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 714516e3336..55e0d6a74f5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3227,6 +3227,9 @@ make_unbound_class_template (tree context, tree name, tree parm_list, if (MAYBE_CLASS_TYPE_P (context)) tmpl = lookup_field (context, name, 0, false); + if (tmpl && TREE_CODE (tmpl) == TYPE_DECL) + tmpl = maybe_get_template_decl_from_type_decl (tmpl); + if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl)) { if (complain & tf_error) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 01c6cb189c2..e40c1e9760b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-11-16 Jason Merrill + + * g++.dg/template/injected2.C: New. + 2010-11-17 Nicola Pero * objc.dg/protocol-optional-1.m: New. diff --git a/gcc/testsuite/g++.dg/template/injected2.C b/gcc/testsuite/g++.dg/template/injected2.C new file mode 100644 index 00000000000..bd09ccc3553 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/injected2.C @@ -0,0 +1,9 @@ +// DR 1004 + +template class U = T::template B> struct A { }; + +template struct B { + template friend struct B; +}; + +A > a;