diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-11-25 17:11:37 +0000 |
---|---|---|
committer | Mark Mitchell <mark@codesourcery.com> | 2004-11-25 17:11:37 +0000 |
commit | 55e5cc5373200d41af154e7d6722e3d7eba927b6 (patch) | |
tree | 1f43cc1480d6fed656039fd8b9ad792166e521e4 /gcc/cp/decl.c | |
parent | d6334794d34e0b4e3af799fce84e8179dd451ed4 (diff) |
PR c++/18001
* c-common.h (lvalue_use): Move here from c-ctypeck.c.
(lvalue_or_else): Declare.
* c-common.c (lvalue_or_else): Move here from c-typeck.c.
* c-typeck.c (lvalue_use): Remove.
(lvalue_or_else): Remove.
PR c++/18556
* toplev.c (check_global_declarations): Set DECL_IGNORED_P on
unemitted variables with static storage duration.
PR c++/18445
* class.c (instantiate_type): Treat NON_DEPENDENT_EXPRs with
unknown_type as non matching. Tidy up.
* pt.c (build_non_dependent_expr): Do not build a
NON_DEPENDENT_EXPR for a VAR_DECL.
PR c++/18001
* cp-tree.h (lvalue_or_else): Remove declaration.
* tree.c (lvalue_or_else): Remove.
* typeck.c (build_unary_op): Adjust call to lvalue_or_else.
(build_modify_expr): Likewise.
PR c++/18625
* decl.c (duplicate_decls): Return error_mark_node on error, as
specified.
PR c++/18466
* decl.c (grokvardecl): Keep track of whether or not a there was
explicit qualification.
* name-lookup.c (set_decl_namespace): Complain about explicit
qualification of a name within its own namespace.
PR c++/18545
* typeck.c (check_return_expr): Robustify.
PR c++/18445
* g++.dg/template/crash28.C: Likewise.
PR c++/18001
* g++.dg/expr/unary2.C: Adjust lvalue messages.
* g++.dg/ext/lvaddr.C: Likewise.
* g++.dg/opt/pr7503-3.C: Likewise.
PR c++/18466
* g++.dg/parse/qualified3.C: New test.
* g++.old-deja/g++.other/friend7.C: Remove bogus qualification.
PR c++/18545
* g++.dg/expr/return1.C: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@91301 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 98ca4f944ad..2085a57fff2 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; |