From: Jakub Jelinek Date: Tue, 22 Apr 2008 22:06:58 +0000 (+0200) Subject: re PR c++/35747 (ICE with undefined variable in statement expression) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d7b5fa315012328dbd9b2fd6cb0e1c82942752c3;p=gcc.git re PR c++/35747 (ICE with undefined variable in statement expression) 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1ea37333236..71bb45ec65b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-04-22 Jakub Jelinek + + PR c++/35747 + * semantics.c (finish_stmt_expr): Call pop_stmt_list even if the stmt + expression is errorneous. + 2008-04-21 Jason Merrill PR c++/35325 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 12cf38750db..f31235b5625 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index af0d3207a67..cf689a4129f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-22 Jakub Jelinek + + PR c++/35747 + * g++.dg/ext/stmtexpr13.C: New test. + 2008-04-22 Ian Lance Taylor * 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 index 00000000000..978da1584e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/stmtexpr13.C @@ -0,0 +1,9 @@ +// PR c++/35747 +// { dg-do compile } +// { dg-options "" } + +void +foo () +{ + ({ i; ({ i; }); 0; }); // { dg-error "was not declared" } +}