aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-07-20 17:58:43 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-07-20 17:58:43 +0000
commitf68e4dc883967d45271ad8772a42df26e07006e3 (patch)
tree044f7049e9a41c4a2c491845702f527069015e47 /gcc
parentf82bb1bed33b152b0093b30b644ae497983b9007 (diff)
downloadgcc-f68e4dc883967d45271ad8772a42df26e07006e3.zip
gcc-f68e4dc883967d45271ad8772a42df26e07006e3.tar.gz
gcc-f68e4dc883967d45271ad8772a42df26e07006e3.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/lookup4.C7
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c05d91f..b4ebd70 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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>
PR c++/16175
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c60158c..2cd9f51 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -9459,6 +9459,7 @@ cp_parser_simple_type_specifier (cp_parser* parser,
if (!(flags & CP_PARSER_FLAGS_NO_USER_DEFINED_TYPES))
{
bool qualified_p;
+ bool global_p;
/* Don't gobble tokens or issue error messages if this is an
optional type-specifier. */
@@ -9466,8 +9467,9 @@ cp_parser_simple_type_specifier (cp_parser* parser,
cp_parser_parse_tentatively (parser);
/* Look for the optional `::' operator. */
- cp_parser_global_scope_opt (parser,
- /*current_scope_valid_p=*/false);
+ global_p
+ = cp_parser_global_scope_opt (parser,
+ /*current_scope_valid_p=*/false);
/* Look for the nested-name specifier. */
qualified_p
= (cp_parser_nested_name_specifier_opt (parser,
@@ -9499,6 +9501,7 @@ cp_parser_simple_type_specifier (cp_parser* parser,
type = cp_parser_type_name (parser);
/* Keep track of all name-lookups performed in class scopes. */
if (type
+ && !global_p
&& !qualified_p
&& TREE_CODE (type) == TYPE_DECL
&& TREE_CODE (DECL_NAME (type)) == IDENTIFIER_NODE)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 64de9d5..c47e7b7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR c++/16175
diff --git a/gcc/testsuite/g++.dg/parse/lookup4.C b/gcc/testsuite/g++.dg/parse/lookup4.C
new file mode 100644
index 0000000..01e5662
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/lookup4.C
@@ -0,0 +1,7 @@
+// PR c++/16637
+
+typedef int I;
+
+struct S {
+ ::I I;
+};