diff options
author | Mark Mitchell <mark@codesourcery.com> | 2006-10-16 23:07:46 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2006-10-16 23:07:46 +0000 |
commit | 21864445019fb2a47312b6afcb2aede62cdc677a (patch) | |
tree | 4516cb9af9e0def299358adb9611a4eda5ac901b | |
parent | b4c74ba24343fb49967075548248964138920c30 (diff) | |
download | gcc-21864445019fb2a47312b6afcb2aede62cdc677a.zip gcc-21864445019fb2a47312b6afcb2aede62cdc677a.tar.gz gcc-21864445019fb2a47312b6afcb2aede62cdc677a.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/dtor12.C | 6 |
4 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f07426a..ff47180 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2006-10-16 Mark Mitchell <mark@codesourcery.com> + 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 691b742..1ffc9ee 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 9d450e7..3bf1718 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2006-10-16 Mark Mitchell <mark@codesourcery.com> + 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 0000000..1acdfa3 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/dtor12.C @@ -0,0 +1,6 @@ +// PR c++/29408 + +template <class T> class a +{ + ~a<T>(); +}; |