aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 98ca4f9..2085a57 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1417,7 +1417,7 @@ duplicate_decls (tree newdecl, tree olddecl)
error ("conflicting declaration %q#D", newdecl);
cp_error_at ("%qD has a previous declaration as %q#D",
olddecl, olddecl);
- return NULL_TREE;
+ return error_mark_node;
}
}
else if (TREE_CODE (newdecl) == FUNCTION_DECL
@@ -5921,10 +5921,13 @@ grokvardecl (tree type,
tree scope)
{
tree decl;
+ tree explicit_scope;
gcc_assert (!name || TREE_CODE (name) == IDENTIFIER_NODE);
- /* Compute the scope in which to place the variable. */
+ /* Compute the scope in which to place the variable, but remember
+ whether or not that scope was explicitly specified by the user. */
+ explicit_scope = scope;
if (!scope)
{
/* An explicit "extern" specifier indicates a namespace-scope
@@ -5949,8 +5952,8 @@ grokvardecl (tree type,
else
decl = build_decl (VAR_DECL, name, type);
- if (scope && TREE_CODE (scope) == NAMESPACE_DECL)
- set_decl_namespace (decl, scope, 0);
+ if (explicit_scope && TREE_CODE (explicit_scope) == NAMESPACE_DECL)
+ set_decl_namespace (decl, explicit_scope, 0);
else
DECL_CONTEXT (decl) = scope;