From: Mark Mitchell Date: Mon, 16 Oct 2006 23:07:46 +0000 (+0000) Subject: re PR c++/29408 (parse error for valid code) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21864445019fb2a47312b6afcb2aede62cdc677a;p=gcc.git re PR c++/29408 (parse error for valid code) PR c++/29408 * parser.c (cp_parser_using_declaration): Stop parsing when something goes wrong with an access declaration. PR c++/29408 * g++.dg/parse/dtor12.C: New test. From-SVN: r117800 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f07426ab8c8..ff4718029e3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2006-10-16 Mark Mitchell + PR c++/29408 + * parser.c (cp_parser_using_declaration): Stop parsing when + something goes wrong with an access declaration. + PR c++/29435 * typeck.c (cxx_sizeof_or_alignof_type): Complete non-dependent types when their sizes are required. Refine test for VLAs. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 691b742fd83..1ffc9ee8877 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -10681,6 +10681,12 @@ cp_parser_using_declaration (cp_parser* parser, if (!qscope) qscope = global_namespace; + if (access_declaration_p && cp_parser_error_occurred (parser)) + /* Something has already gone wrong; there's no need to parse + further. Since an error has occurred, the return value of + cp_parser_parse_definitely will be false, as required. */ + return cp_parser_parse_definitely (parser); + /* Parse the unqualified-id. */ identifier = cp_parser_unqualified_id (parser, /*template_keyword_p=*/false, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9d450e76b64..3bf1718e792 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2006-10-16 Mark Mitchell + PR c++/29408 + * g++.dg/parse/dtor12.C: New test. + PR c++/29435 * g++.dg/template/sizeof11.C: New test. diff --git a/gcc/testsuite/g++.dg/parse/dtor12.C b/gcc/testsuite/g++.dg/parse/dtor12.C new file mode 100644 index 00000000000..1acdfa36b69 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/dtor12.C @@ -0,0 +1,6 @@ +// PR c++/29408 + +template class a +{ + ~a(); +};