OSDN Git Service

DR 1004
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Nov 2010 01:43:02 +0000 (01:43 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 17 Nov 2010 01:43:02 +0000 (01:43 +0000)
* decl.c (make_unbound_class_template): Handle using
injected-type-name as template.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166850 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/injected2.C [new file with mode: 0644]

index cdbec79..e32c3b7 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-16  Jason Merrill  <jason@redhat.com>
+
+       DR 1004
+       * decl.c (make_unbound_class_template): Handle using
+       injected-type-name as template.
+
 2010-11-15  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * typeck.c (cp_build_unary_op): Use
index 714516e..55e0d6a 100644 (file)
@@ -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)
index 01c6cb1..e40c1e9 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-16  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/template/injected2.C: New.
+
 2010-11-17  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * 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 (file)
index 0000000..bd09ccc
--- /dev/null
@@ -0,0 +1,9 @@
+// DR 1004
+
+template <class T, template<class>class U = T::template B> struct A { };
+
+template <class T> struct B {
+  template <class U> friend struct B;
+};
+
+A<B<int> > a;