Commit f68e4dc8 by Mark Mitchell Committed by Mark Mitchell

re PR c++/16637 (syntax error on valid input code)

	PR c++/16637
	* parser.c (cp_parser_simple_type_specifier): Do not record usage
	of globally-qualified names.

	PR c++/16637
	* g++.dg/parse/lookup4.C: New test.

From-SVN: r84965
parent f82bb1be
2004-07-20 Mark Mitchell <mark@codesourcery.com>
PR c++/16637
* parser.c (cp_parser_simple_type_specifier): Do not record usage
of globally-qualified names.
2004-07-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2004-07-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/16175 PR c++/16175
......
...@@ -9459,6 +9459,7 @@ cp_parser_simple_type_specifier (cp_parser* parser, ...@@ -9459,6 +9459,7 @@ cp_parser_simple_type_specifier (cp_parser* parser,
if (!(flags & CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES)) if (!(flags & CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES))
{ {
bool qualified_p; bool qualified_p;
bool global_p;
/* Don't gobble tokens or issue error messages if this is an /* Don't gobble tokens or issue error messages if this is an
optional type-specifier. */ optional type-specifier. */
...@@ -9466,8 +9467,9 @@ cp_parser_simple_type_specifier (cp_parser* parser, ...@@ -9466,8 +9467,9 @@ cp_parser_simple_type_specifier (cp_parser* parser,
cp_parser_parse_tentatively (parser); cp_parser_parse_tentatively (parser);
/* Look for the optional `::' operator. */ /* Look for the optional `::' operator. */
cp_parser_global_scope_opt (parser, global_p
/*current_scope_valid_p=*/false); = cp_parser_global_scope_opt (parser,
/*current_scope_valid_p=*/false);
/* Look for the nested-name specifier. */ /* Look for the nested-name specifier. */
qualified_p qualified_p
= (cp_parser_nested_name_specifier_opt (parser, = (cp_parser_nested_name_specifier_opt (parser,
...@@ -9499,6 +9501,7 @@ cp_parser_simple_type_specifier (cp_parser* parser, ...@@ -9499,6 +9501,7 @@ cp_parser_simple_type_specifier (cp_parser* parser,
type = cp_parser_type_name (parser); type = cp_parser_type_name (parser);
/* Keep track of all name-lookups performed in class scopes. */ /* Keep track of all name-lookups performed in class scopes. */
if (type if (type
&& !global_p
&& !qualified_p && !qualified_p
&& TREE_CODE (type) == TYPE_DECL && TREE_CODE (type) == TYPE_DECL
&& TREE_CODE (DECL_NAME (type)) == IDENTIFIER_NODE) && TREE_CODE (DECL_NAME (type)) == IDENTIFIER_NODE)
......
2004-07-20 Mark Mitchell <mark@codesourcery.com>
PR c++/16637
* g++.dg/parse/lookup4.C: New test.
2004-07-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2004-07-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/16175 PR c++/16175
......
// PR c++/16637
typedef int I;
struct S {
::I I;
};
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