Commit 3afeafbc by Paolo Carlini Committed by Paolo Carlini

re PR c++/51216 (ICE with statement expression)

/cp
2011-11-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51216
	* semantics.c (potential_constant_expression_1): Handle IF_STMT,
	DO_STMT, FOR_STMT, and WHILE_STMT.

/testsuite
2011-11-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51216
	* g++.dg/cpp0x/pr51216.C: New.

From-SVN: r181517
parent b168ced9
2011-11-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51216
* semantics.c (potential_constant_expression_1): Handle IF_STMT,
DO_STMT, FOR_STMT, and WHILE_STMT.
2011-11-18 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/51188
......
......@@ -8178,6 +8178,10 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
case EXPR_STMT:
case BIND_EXPR:
case TRANSACTION_EXPR:
case IF_STMT:
case DO_STMT:
case FOR_STMT:
case WHILE_STMT:
if (flags & tf_error)
error ("expression %qE is not a constant-expression", t);
return false;
......
2011-11-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51216
* g++.dg/cpp0x/pr51216.C: New.
2011-11-19 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/delay-slot-2.c: New test.
......
// PR c++/51216
// { dg-options "-std=c++0x" }
void foo()
{
int i = ({ if (1) ; }); // { dg-error "ignored" }
int j = ({ for (;;) ; }); // { dg-error "ignored" }
int k = ({ while (1) ; }); // { dg-error "ignored" }
int l = ({ do { } while (1); }); // { dg-error "ignored" }
}
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