]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/27359 (ICE with missing initialization of iteration variable in parallel...
authorJakub Jelinek <jakub@redhat.com>
Thu, 4 May 2006 06:29:16 +0000 (08:29 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 4 May 2006 06:29:16 +0000 (08:29 +0200)
PR c++/27359
* parser.c (cp_parser_omp_for_loop): Only call
cp_parser_abort_tentative_parse if cp_parser_parse_definitely was not
called.

* g++.dg/gomp/pr27359.C: New test.

From-SVN: r113513

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

index 1b8438cb03efdde10d791df2251c9489f8093209..d4a01fcd68fafeb8eb7aa9a7dc8cfb28bee0b5f5 100644 (file)
@@ -1,3 +1,10 @@
+2006-05-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/27359
+       * parser.c (cp_parser_omp_for_loop): Only call
+       cp_parser_abort_tentative_parse if cp_parser_parse_definitely was not
+       called.
+
 2006-05-02  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/27102
index ff8086fd559c088b5e1c7002f8a90c2d7a896554..bee7e9af61ec5e79275dcaacc5bcfafa22eaeb42 100644 (file)
@@ -18506,14 +18506,13 @@ cp_parser_omp_for_loop (cp_parser *parser)
                pop_scope (pushed_scope);
            }
        }
+      else
+       cp_parser_abort_tentative_parse (parser);
 
       /* If parsing as an initialized declaration failed, try again as
         a simple expression.  */
       if (decl == NULL)
-       {
-         cp_parser_abort_tentative_parse (parser);
-         init = cp_parser_expression (parser, false);
-       }
+       init = cp_parser_expression (parser, false);
     }
   cp_parser_require (parser, CPP_SEMICOLON, "`;'");
   pre_body = pop_stmt_list (pre_body);
index 399b36dab161c7c7a8ad73fe0922329a0f804e16..35e0698407d61b2a71f1a9bd3a7afde29c03b00d 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/27359
+       * g++.dg/gomp/pr27359.C: New test.
+
 2006-05-02  Steven G. Kargl  <kargls@comcast.net>
 
        PR fortran/20248
diff --git a/gcc/testsuite/g++.dg/gomp/pr27359.C b/gcc/testsuite/g++.dg/gomp/pr27359.C
new file mode 100644 (file)
index 0000000..603898c
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/27359
+// { dg-do compile }
+
+void
+foo ()
+{
+#pragma omp parallel for
+  for (int i; i < 1; ++i)      // { dg-error "expected|was not declared" }
+    ;
+}
This page took 0.113414 seconds and 5 git commands to generate.