Commit b5a029b1 by Jason Merrill Committed by Jason Merrill

re PR c++/38278 (C++ namespace collision)

        PR c++/38278
        * parser.c (cp_parser_class_name): Only call
        maybe_note_name_used_in_class if we actually found a class name.

From-SVN: r142263
parent fdbeaf4c
2008-11-28 Jason Merrill <jason@redhat.com>
PR c++/38278
* parser.c (cp_parser_class_name): Only call
maybe_note_name_used_in_class if we actually found a class name.
2008-11-25 Jason Merrill <jason@redhat.com> 2008-11-25 Jason Merrill <jason@redhat.com>
PR c++/28743 PR c++/28743
......
...@@ -14686,6 +14686,7 @@ cp_parser_class_name (cp_parser *parser, ...@@ -14686,6 +14686,7 @@ cp_parser_class_name (cp_parser *parser,
tree scope; tree scope;
bool typename_p; bool typename_p;
cp_token *token; cp_token *token;
tree identifier = NULL_TREE;
/* All class-names start with an identifier. */ /* All class-names start with an identifier. */
token = cp_lexer_peek_token (parser->lexer); token = cp_lexer_peek_token (parser->lexer);
...@@ -14711,7 +14712,6 @@ cp_parser_class_name (cp_parser *parser, ...@@ -14711,7 +14712,6 @@ cp_parser_class_name (cp_parser *parser,
&& !cp_parser_nth_token_starts_template_argument_list_p (parser, 2)) && !cp_parser_nth_token_starts_template_argument_list_p (parser, 2))
{ {
cp_token *identifier_token; cp_token *identifier_token;
tree identifier;
bool ambiguous_p; bool ambiguous_p;
/* Look for the identifier. */ /* Look for the identifier. */
...@@ -14767,9 +14767,6 @@ cp_parser_class_name (cp_parser *parser, ...@@ -14767,9 +14767,6 @@ cp_parser_class_name (cp_parser *parser,
} }
return error_mark_node; return error_mark_node;
} }
else if (decl != error_mark_node
&& !parser->scope)
maybe_note_name_used_in_class (identifier, decl);
} }
} }
else else
...@@ -14819,6 +14816,8 @@ cp_parser_class_name (cp_parser *parser, ...@@ -14819,6 +14816,8 @@ cp_parser_class_name (cp_parser *parser,
if (decl == error_mark_node) if (decl == error_mark_node)
cp_parser_error (parser, "expected class-name"); cp_parser_error (parser, "expected class-name");
else if (identifier && !parser->scope)
maybe_note_name_used_in_class (identifier, decl);
return decl; return decl;
} }
......
2008-11-28 Jason Merrill <jason@redhat.com>
PR c++/38278
* g++.dg/lookup/name-clash8.C: New test.
2008-11-28 H.J. Lu <hongjiu.lu@intel.com> 2008-11-28 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/37843 PR middle-end/37843
......
// PR c++/38278
struct foo { };
void bar();
struct baz {
static foo (bar)();
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment