]> gcc.gnu.org Git - gcc.git/commitdiff
decl.c (lookup_name_real): Don't forget the TYPENAME_TYPE we're looking inside.
authorJason Merrill <jason@redhat.com>
Sat, 12 Aug 2000 00:02:49 +0000 (20:02 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 12 Aug 2000 00:02:49 +0000 (20:02 -0400)
        * decl.c (lookup_name_real): Don't forget the TYPENAME_TYPE we're
        looking inside.

From-SVN: r35650

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.old-deja/g++.ext/typename1.C [new file with mode: 0644]

index 2ce3f448605bea835dbd8179a8deb1d343f6923d..27126a5b297ce49665b71dff4812a97bec820108 100644 (file)
@@ -1,3 +1,8 @@
+2000-08-11  Jason Merrill  <jason@redhat.com>
+
+       * decl.c (lookup_name_real): Don't forget the TYPENAME_TYPE we're
+       looking inside.
+
 2000-08-11  Nathan Sidwell  <nathan@codesourcery.com>
 
        * cp-tree.h (resolve_scope_to_name): Remove unused prototype.
@@ -882,7 +887,7 @@ Wed Jul 26 15:05:51 CEST 2000       Marc Espie <espie@cvs.openbsd.org>
        * semantics.c (emit_associated_thunks): New function.
        (expand_body): Use it.
        * ir.texi: Adjust decriptions of thunks.
-       
+
 2000-06-22  Jason Merrill  <jason@redhat.com>
 
        * pt.c (tsubst_decl, case FUNCTION_DECL): Clear DECL_SAVED_TREE.
index d3a0e52bd1276770dc1f6a8bce64126a9a007672..e84264df391e7b429b22be3ff948c82ad52a5ab6 100644 (file)
@@ -5898,6 +5898,13 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
            {
              val = lookup_member (type, name, 0, prefer_type);
              type_access_control (type, val);
+
+             /* Restore the containing TYPENAME_TYPE if we looked
+                through it before.  */
+             if (got_scope && got_scope != type
+                 && val && TREE_CODE (val) == TYPE_DECL
+                 && TREE_CODE (TREE_TYPE (val)) == TYPENAME_TYPE)
+               TYPE_CONTEXT (TREE_TYPE (val)) = got_scope;
            }
        }
       else
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/typename1.C b/gcc/testsuite/g++.old-deja/g++.ext/typename1.C
new file mode 100644 (file)
index 0000000..31de28f
--- /dev/null
@@ -0,0 +1,32 @@
+// Bug: g++ forgets about the instantiation of class1 when looking up
+// class11_value, and tries to look things up in class1<class2>.
+
+// Special g++ Options:
+
+template<class ItIsInt>
+struct class1 {
+  struct class11 {
+    typedef ItIsInt class11_value;
+  };
+};
+
+template<class ItIsClass2>
+struct class3 {
+  int f();
+};
+
+template<class ItIsClass2>
+int class3<ItIsClass2>::f()
+{
+  return class1<typename ItIsClass2::class2_value>::class11::class11_value(10);
+}
+
+struct class2 {
+  typedef int class2_value;
+};
+
+int main()
+{
+  class3<class2> the_class3;
+  the_class3.f();
+}
This page took 0.099376 seconds and 5 git commands to generate.