re PR c++/9112 (new C++ parser rejects code older parsers accepted)
PR c++/9112 * parser.c (cp_parser_direct_declarator): Handle erroneous parenthesized declarators correctly. PR c++/9112 * g++.dg/parse/expr1.C: New test. From-SVN: r60706
This commit is contained in:
parent
9e56a932f9
commit
abda8efeda
4 changed files with 24 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2002-12-31 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/9112
|
||||
* parser.c (cp_parser_direct_declarator): Handle erroneous
|
||||
parenthesized declarators correctly.
|
||||
|
||||
2002-12-31 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||
|
||||
* cp-tree.h (pending_lang_change): Declare.
|
||||
|
|
|
@ -10023,6 +10023,8 @@ cp_parser_direct_declarator (parser, abstract_p, ctor_dtor_or_conv_p)
|
|||
declarator. */
|
||||
if (token->type == CPP_OPEN_PAREN)
|
||||
{
|
||||
bool error_p;
|
||||
|
||||
/* For an abstract declarator we do not know whether we are
|
||||
looking at the beginning of a parameter-declaration-clause,
|
||||
or at a parenthesized abstract declarator. For example, if
|
||||
|
@ -10041,7 +10043,7 @@ cp_parser_direct_declarator (parser, abstract_p, ctor_dtor_or_conv_p)
|
|||
declarator
|
||||
= cp_parser_declarator (parser, abstract_p, ctor_dtor_or_conv_p);
|
||||
/* Expect a `)'. */
|
||||
cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
|
||||
error_p = !cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
|
||||
|
||||
/* If parsing a parenthesized abstract declarator didn't work,
|
||||
try a parameter-declaration-clause. */
|
||||
|
@ -10050,7 +10052,8 @@ cp_parser_direct_declarator (parser, abstract_p, ctor_dtor_or_conv_p)
|
|||
/* If we were not parsing an abstract declarator, but failed to
|
||||
find a satisfactory nested declarator, then an error has
|
||||
occurred. */
|
||||
else if (!abstract_p && declarator == error_mark_node)
|
||||
else if (!abstract_p
|
||||
&& (declarator == error_mark_node || error_p))
|
||||
return error_mark_node;
|
||||
/* Default args cannot appear in an abstract decl. */
|
||||
parser->default_arg_ok_p = false;
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2002-12-31 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/9112
|
||||
* g++.dg/parse/expr1.C: New test.
|
||||
|
||||
2002-12-30 Daniel Jacobowitz <drow@mvista.com>
|
||||
|
||||
* gcc.c-torture/compile/20021230-1.c: New test.
|
||||
|
|
8
gcc/testsuite/g++.dg/parse/expr1.C
Normal file
8
gcc/testsuite/g++.dg/parse/expr1.C
Normal file
|
@ -0,0 +1,8 @@
|
|||
struct A {
|
||||
A (int, int);
|
||||
void f ();
|
||||
};
|
||||
|
||||
void f (int a) {
|
||||
A (a, a).f ();
|
||||
}
|
Loading…
Add table
Reference in a new issue