+2001-04-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Set context of namespace scope
+ TYPE_DECLS.
+
2001-04-24 Zack Weinberg <zackw@stanford.edu>
* cp/optimize.c: Include hashtab.h.
decl = build_lang_decl (TYPE_DECL, declarator, type);
}
else
- decl = build_decl (TYPE_DECL, declarator, type);
-
+ {
+ decl = build_decl (TYPE_DECL, declarator, type);
+ if (!current_function_decl)
+ DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
+ }
+
/* If the user declares "typedef struct {...} foo" then the
struct will have an anonymous name. Fill that name in now.
Nothing can refer to it, so nothing needs know about the name
+2001-04-25 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.ns/type2.C: New test.
+
2001-04-24 Zack Weinberg <zackw@stanford.edu>
* g++.old-deja/g++.other/perf1.C: New test.
--- /dev/null
+// Build don't link:
+//
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 11 April 2001 <nathan@codesourcery.com>
+// Origin:stephen.webb@cybersafe.com
+
+// Bug 2125. TYPE_DECLS never had their DECL_CONTEXT set, which
+// confused forward references to classes.
+
+typedef void T;
+namespace A {
+ class C;
+ typedef class C C;
+ typedef int T;
+ class C
+ {
+ T i; // got bogus error, found wrong T
+ };
+}