Commit 76b9a2a1 by Andrew Pinski Committed by Andrew Pinski

re PR c++/30158 (ICE with invalid statement-expressions)

2007-02-15  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/30158
        * semantics.c (finish_stmt_expr_expr): Set TREE_TYPE of the
        statement expression if we had an error mark node.
2007-02-15  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/30158
        * g++.dg/ext/stmtexpr10.C: New testcase.

From-SVN: r122028
parent d3d6f724
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/30158
* semantics.c (finish_stmt_expr_expr): Set TREE_TYPE of the
statement expression if we had an error mark node.
2007-02-15 Sandra Loosemore <sandra@codesourcery.com> 2007-02-15 Sandra Loosemore <sandra@codesourcery.com>
Brooks Moses <brooks.moses@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com>
Lee Millward <lee.millward@codesourcery.com> Lee Millward <lee.millward@codesourcery.com>
......
...@@ -1631,7 +1631,12 @@ tree ...@@ -1631,7 +1631,12 @@ tree
finish_stmt_expr_expr (tree expr, tree stmt_expr) finish_stmt_expr_expr (tree expr, tree stmt_expr)
{ {
if (error_operand_p (expr)) if (error_operand_p (expr))
return error_mark_node; {
/* The type of the statement-expression is the type of the last
expression. */
TREE_TYPE (stmt_expr) = error_mark_node;
return error_mark_node;
}
/* If the last statement does not have "void" type, then the value /* If the last statement does not have "void" type, then the value
of the last statement is the value of the entire expression. */ of the last statement is the value of the entire expression. */
......
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com> 2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/30158
* g++.dg/ext/stmtexpr10.C: New testcase.
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/30729 PR middle-end/30729
* gcc.dg/Wunused-value-2.c: New testcase. * gcc.dg/Wunused-value-2.c: New testcase.
/* { dg-do compile } " */
/* { dg-options "" } */
void foo(int i)
{
(i ? 1 : 2) = ({ X; }); /* { dg-error "" } */
}
struct A
{
~A ();
void foo()
{
delete this = ({ X; }); /* { dg-error "" } */
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment