re PR c++/14668 (no warning anymore for reevaluation of declaration)

PR c++/14668
	* parser.c (cp_parser_simple_type_specifier): Call
	maybe_note_name_used_in_class.

	PR c++/14668
	* g++.dg/lookup/redecl1.C: New test.
	* g++.old-deja/g++.benjamin/tem04.C: Add error marker.

From-SVN: r82375
This commit is contained in:
Mark Mitchell 2004-05-28 20:17:18 +00:00 committed by Mark Mitchell
parent 09b01df889
commit 0c1a1ecd80
5 changed files with 34 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-05-28 Mark Mitchell <mark@codesourcery.com>
PR c++/14668
* parser.c (cp_parser_simple_type_specifier): Call
maybe_note_name_used_in_class.
2004-05-28 Tom Marshall <tmarshall@real.com>
PR c++/15214

View File

@ -8944,6 +8944,8 @@ cp_parser_simple_type_specifier (cp_parser* parser, cp_parser_flags flags,
/* The type-specifier must be a user-defined type. */
if (!(flags & CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES))
{
bool qualified_p;
/* Don't gobble tokens or issue error messages if this is an
optional type-specifier. */
if (flags & CP_PARSER_FLAGS_OPTIONAL)
@ -8953,11 +8955,12 @@ cp_parser_simple_type_specifier (cp_parser* parser, cp_parser_flags flags,
cp_parser_global_scope_opt (parser,
/*current_scope_valid_p=*/false);
/* Look for the nested-name specifier. */
cp_parser_nested_name_specifier_opt (parser,
/*typename_keyword_p=*/false,
/*check_dependency_p=*/true,
/*type_p=*/false,
/*is_declaration=*/false);
qualified_p
= (cp_parser_nested_name_specifier_opt (parser,
/*typename_keyword_p=*/false,
/*check_dependency_p=*/true,
/*type_p=*/false,
/*is_declaration=*/false));
/* If we have seen a nested-name-specifier, and the next token
is `template', then we are using the template-id production. */
if (parser->scope
@ -8979,6 +8982,12 @@ cp_parser_simple_type_specifier (cp_parser* parser, cp_parser_flags flags,
/* Otherwise, look for a type-name. */
else
type = cp_parser_type_name (parser);
/* Keep track of all name-lookups performed in class scopes. */
if (type
&& !qualified_p
&& TREE_CODE (type) == TYPE_DECL
&& TREE_CODE (DECL_NAME (type)) == IDENTIFIER_NODE)
maybe_note_name_used_in_class (DECL_NAME (type), type);
/* If it didn't work out, we don't have a TYPE. */
if ((flags & CP_PARSER_FLAGS_OPTIONAL)
&& !cp_parser_parse_definitely (parser))

View File

@ -1,3 +1,9 @@
2004-05-28 Mark Mitchell <mark@codesourcery.com>
PR c++/14668
* g++.dg/lookup/redecl1.C: New test.
* g++.old-deja/g++.benjamin/tem04.C: Add error marker.
2004-05-28 Paolo Bonzini <bonzini@gnu.org>
* gcc.c-torture/compare-fp-1.c, gcc.c-torture/compare-fp-2.c,

View File

@ -0,0 +1,7 @@
// PR c++/14668
class A {}; // { dg-error "" }
class B {
static A *A; // { dg-error "" }
};
A *B::A = 0;

View File

@ -91,7 +91,7 @@ public:
template <typename T14, template <typename T15> class C12>// { dg-error "" } .*
class Xeighteen {
protected:
C12<T14> value;
C12<T14> value; // { dg-error "" }
int C12; // { dg-error "" } .*
};