OSDN Git Service

PR c++/29408
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Oct 2006 23:07:46 +0000 (23:07 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Oct 2006 23:07:46 +0000 (23:07 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117800 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/dtor12.C [new file with mode: 0644]

index f07426a..ff47180 100644 (file)
@@ -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.
index 691b742..1ffc9ee 100644 (file)
@@ -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,
index 9d450e7..3bf1718 100644 (file)
@@ -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 (file)
index 0000000..1acdfa3
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/29408
+
+template <class T> class a
+{
+  ~a<T>();
+};