+2004-01-11 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ PR c++/13544
+ * decl.c (build_enumerator): Set DECL_CONTEXT after the enumerator
+ has been pushed.
+ (pushdecl): Don't use DECL_NAMESPACE_SCOPE_P to test whether a
+ decl has a namespace-scope; that isn't really what it means.
+
2004-01-02 Matthias Klose <doko@debian.org>
Backport from mainline:
/* In case this decl was explicitly namespace-qualified, look it
up in its namespace context. */
- if (DECL_NAMESPACE_SCOPE_P (x) && namespace_bindings_p ())
- t = namespace_binding (name, DECL_CONTEXT (x));
+ if ((DECL_CONTEXT (x) && TREE_CODE (DECL_CONTEXT (x)) == NAMESPACE_DECL)
+ && namespace_bindings_p ())
+ t = namespace_binding (name, DECL_CONTEXT (x));
else
t = lookup_name_current_level (name);
a function could mean local to a class method. */
decl = build_decl (CONST_DECL, name, type);
- DECL_CONTEXT (decl) = FROB_CONTEXT (context);
DECL_INITIAL (decl) = value;
TREE_READONLY (decl) = 1;
things like `S::i' later.) */
finish_member_declaration (decl);
else
- pushdecl (decl);
+ {
+ pushdecl (decl);
+ /* Contrary to finish_member_declaration, pushdecl does not properly
+ set the DECL_CONTEXT. Do that now here. Doing that before calling
+ pushdecl will confuse the logic used in that function. Hopefully,
+ future versions will implement a more straight logic. */
+ DECL_CONTEXT (decl) = FROB_CONTEXT (context);
+ }
/* Add this enumeration constant to the list for this type. */
TYPE_VALUES (enumtype) = tree_cons (name, decl, TYPE_VALUES (enumtype));