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
This commit is contained in:
parent
27dc0551a1
commit
712becabc6
@ -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.
|
||||
|
@ -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:
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-01-16 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.dg/parse/ambig2.C: New test.
|
||||
|
||||
2003-01-15 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* g++.dg/tls/init-2.C: Update error message string.
|
||||
|
27
gcc/testsuite/g++.dg/parse/ambig2.C
Normal file
27
gcc/testsuite/g++.dg/parse/ambig2.C
Normal file
@ -0,0 +1,27 @@
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 6 Jan 2003 <nathan@codesourcery.com>
|
||||
|
||||
// PR 9212. We erroneously accepted an ill-formed
|
||||
// function-declaration, rather than a variable initializer.
|
||||
|
||||
|
||||
struct A
|
||||
{
|
||||
enum E { e };
|
||||
A(E);
|
||||
};
|
||||
|
||||
struct B
|
||||
{
|
||||
enum F { f };
|
||||
B(F);
|
||||
};
|
||||
|
||||
struct C
|
||||
{
|
||||
C(A, B, A);
|
||||
};
|
||||
|
||||
C c(A(A::e), B(B::f), A(A::e)); // This is not a function declaration
|
Loading…
Reference in New Issue
Block a user