aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-01-16 17:08:54 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-01-16 17:08:54 +0000
commit712becabc6c22330c5d49f84eaf3d130048c8226 (patch)
treee4c9854954916b9a5ca7f242911869bdc1e5220c /gcc/cp
parent27dc0551a1180e1032b80bc64d066058c3a2ad70 (diff)
downloadgcc-712becabc6c22330c5d49f84eaf3d130048c8226.zip
gcc-712becabc6c22330c5d49f84eaf3d130048c8226.tar.gz
gcc-712becabc6c22330c5d49f84eaf3d130048c8226.tar.bz2
re PR c++/9212 (Internal compiler error in grokdeclarator, at cp/decl.c:11052 [gcc 3.2])
cp: PR C++/9212 * parser.c (cp_parser_direct_declarator): If accepting either abstract or named, the name must be an unqualified-id. testsuite: * g++.dg/parse/ambig2.C: New test. From-SVN: r61399
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c18
2 files changed, 19 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 826d736..39b294d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-01-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/9212
+ * parser.c (cp_parser_direct_declarator): If accepting either
+ abstract or named, the name must be an unqualified-id.
+
2003-01-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* class.c (layout_virtual_bases): Avoid signed/unsigned warning.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 68997ad..07b35a2 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -1150,7 +1150,7 @@ typedef enum cp_parser_declarator_kind
CP_PARSER_DECLARATOR_ABSTRACT,
/* We want a named declarator. */
CP_PARSER_DECLARATOR_NAMED,
- /* We don't mind. */
+ /* We don't mind, but the name must be an unqualified-id */
CP_PARSER_DECLARATOR_EITHER
} cp_parser_declarator_kind;
@@ -10168,16 +10168,24 @@ cp_parser_direct_declarator (parser, dcl_kind, ctor_dtor_or_conv_p)
if (dcl_kind == CP_PARSER_DECLARATOR_EITHER)
cp_parser_parse_tentatively (parser);
declarator = cp_parser_declarator_id (parser);
- if (dcl_kind == CP_PARSER_DECLARATOR_EITHER
- && !cp_parser_parse_definitely (parser))
- declarator = error_mark_node;
+ if (dcl_kind == CP_PARSER_DECLARATOR_EITHER)
+ {
+ if (!cp_parser_parse_definitely (parser))
+ declarator = error_mark_node;
+ else if (TREE_CODE (declarator) != IDENTIFIER_NODE)
+ {
+ cp_parser_error (parser, "expected unqualified-id");
+ declarator = error_mark_node;
+ }
+ }
+
if (declarator == error_mark_node)
break;
if (TREE_CODE (declarator) == SCOPE_REF)
{
tree scope = TREE_OPERAND (declarator, 0);
-
+
/* In the declaration of a member of a template class
outside of the class itself, the SCOPE will sometimes
be a TYPENAME_TYPE. For example, given: