summaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 02:23:16 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 02:23:16 +0000
commit46f43a6ba260793821313b27d79306c976dd29c5 (patch)
tree62c200d8b2b8702e81da0dc741d655791644796a /gcc/cp/parser.c
parent98116afdae5cc43c4ec9de61fadf36b7b433a89d (diff)
downloadgcc-46f43a6ba260793821313b27d79306c976dd29c5.tar.gz
PR c++/18093
* search.c (current_scope): Return the innermost non-block scope, not the innermost non-block, non-namespace scope. (at_namespace_scope_p): Adjust accordingly. (dfs_accessible_post): Do not pass namespaces to is_friend. (dfs_walk_once_accessible_r): Likewise. * decl.c (grokvardecl): Adjust call to current_scope. (build_enumerator): Likewise. * parser.c (cp_parser_using_declaration): Likewise. (cp_parser_direct_declarator): Use at_namespace_scope_p instead of current_scope. (cp_parser_class_head): Adjust call to current_scope. * name-lookup.c (do_namespace_alias): Set the DECL_CONTEXT for the alias. PR c++/18020 * pt.c (tusbst_copy_and_build): Resolve enumeration constants to their underlying values. PR c++/18161 * typeck.c (build_binary_op): Honor build_type, even when in a template. PR c++/18093 * g++.dg/lookup/ns2.C: New test. PR c++/18020 * g++.dg/template/enum4.C: New test. PR c++/18161 * g++.dg/template/expr1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89627 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index fe3b3c61744..b6e5432c8b0 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -10047,7 +10047,6 @@ cp_parser_using_declaration (cp_parser* parser)
bool global_scope_p;
tree decl;
tree identifier;
- tree scope;
tree qscope;
/* Look for the `using' keyword. */
@@ -10106,8 +10105,7 @@ cp_parser_using_declaration (cp_parser* parser)
error ("a template-id may not appear in a using-declaration");
else
{
- scope = current_scope ();
- if (scope && TYPE_P (scope))
+ if (at_class_scope_p ())
{
/* Create the USING_DECL. */
decl = do_class_using_decl (build_nt (SCOPE_REF,
@@ -10121,7 +10119,7 @@ cp_parser_using_declaration (cp_parser* parser)
decl = cp_parser_lookup_name_simple (parser, identifier);
if (decl == error_mark_node)
cp_parser_name_lookup_error (parser, identifier, decl, NULL);
- else if (scope)
+ else if (!at_namespace_scope_p ())
do_local_using_decl (decl, qscope, identifier);
else
do_toplevel_using_decl (decl, qscope, identifier);
@@ -10982,7 +10980,7 @@ cp_parser_direct_declarator (cp_parser* parser,
break;
}
- if (TREE_CODE (id) == SCOPE_REF && !current_scope ())
+ if (TREE_CODE (id) == SCOPE_REF && at_namespace_scope_p ())
{
tree scope = TREE_OPERAND (id, 0);
@@ -12560,8 +12558,6 @@ cp_parser_class_head (cp_parser* parser,
tree scope;
/* Figure out in what scope the declaration is being placed. */
scope = current_scope ();
- if (!scope)
- scope = current_namespace;
/* If that scope does not contain the scope in which the
class was originally declared, the program is invalid. */
if (scope && !is_ancestor (scope, nested_name_specifier))