re PR c++/35747 (ICE with undefined variable in statement expression)
authorJakub Jelinek <jakub@redhat.com>
Tue, 22 Apr 2008 22:06:58 +0000 (00:06 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 22 Apr 2008 22:06:58 +0000 (00:06 +0200)
PR c++/35747
* semantics.c (finish_stmt_expr): Call pop_stmt_list even if the stmt
expression is errorneous.

* g++.dg/ext/stmtexpr13.C: New test.

From-SVN: r134567

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/stmtexpr13.C [new file with mode: 0644]

index 1ea373332369a271d5f69e6504c1d72596b9b12a..71bb45ec65be01526d627f9cbaa55888020427e2 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/35747
+       * semantics.c (finish_stmt_expr): Call pop_stmt_list even if the stmt
+       expression is errorneous.
+
 2008-04-21  Jason Merrill  <jason@redhat.com>
 
        PR c++/35325
index 12cf38750dba230c226386cdf4a670bf5cdc38d1..f31235b5625ba2f485b0dcf43c000fac1682c323 100644 (file)
@@ -1739,7 +1739,10 @@ finish_stmt_expr (tree stmt_expr, bool has_no_scope)
   tree result;
 
   if (error_operand_p (stmt_expr))
-    return error_mark_node;
+    {
+      pop_stmt_list (stmt_expr);
+      return error_mark_node;
+    }
 
   gcc_assert (TREE_CODE (stmt_expr) == STATEMENT_LIST);
 
index af0d3207a67793447fbaaf725600b9b0ec63b0f0..cf689a4129f324fd30fa53b66691614819c706b9 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/35747
+       * g++.dg/ext/stmtexpr13.C: New test.
+
 2008-04-22  Ian Lance Taylor  <iant@google.com>
 
        * gcc.c-torture/compile/20080419-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr13.C b/gcc/testsuite/g++.dg/ext/stmtexpr13.C
new file mode 100644 (file)
index 0000000..978da15
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/35747
+// { dg-do compile }
+// { dg-options "" }
+
+void
+foo ()
+{
+  ({ i; ({ i; }); 0; });       // { dg-error "was not declared" }
+}