{
tree using_directive = make_node (IMPORTED_DECL);
TREE_TYPE (using_directive) = void_type_node;
+ DECL_CONTEXT (using_directive) = current_function_decl;
IMPORTED_DECL_ASSOCIATED_DECL (using_directive) = decl;
DECL_CHAIN (using_directive) = BLOCK_VARS (block);
return NAMESPACE_LEVEL (global_namespace)->names;
}
-/* Push DECL into the current scope. */
+/* Push DECL into the current (namespace) scope. */
tree
cp_pushdecl (tree decl)
{
+ DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
return pushdecl (decl);
}
/* If this decl has namespace scope, set that up. */
if (in_namespace)
set_decl_namespace (decl, in_namespace, friendp);
- else if (!ctype)
+ else if (ctype)
+ DECL_CONTEXT (decl) = ctype;
+ else
DECL_CONTEXT (decl) = FROB_CONTEXT (current_decl_namespace ());
/* `main' and builtins have implicit 'C' linkage. */
if (deletedp)
DECL_DELETED_FN (decl) = 1;
- if (ctype)
- {
- DECL_CONTEXT (decl) = ctype;
- if (funcdef_flag)
- check_class_member_definition_namespace (decl);
- }
+ if (ctype && funcdef_flag)
+ check_class_member_definition_namespace (decl);
if (ctype == NULL_TREE && DECL_MAIN_P (decl))
{