re PR c++/64701 (internal compiler error: unexpected expression ‘<statement>’ of kind do_stmt)

PR c++/64701
	* constexpr.c (maybe_constant_value): Just hand back STATEMENT_LIST.

From-SVN: r220046
This commit is contained in:
Jason Merrill 2015-01-23 11:29:46 -05:00 committed by Jason Merrill
parent 6fc2d0f362
commit c6e7c499a3
3 changed files with 24 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2015-01-23 Jason Merrill <jason@redhat.com>
PR c++/64701
* constexpr.c (maybe_constant_value): Just hand back STATEMENT_LIST.
PR c++/64727
* constexpr.c (cxx_eval_constant_expression): Allow for lvalue use
of CONST_DECL.

View File

@ -3454,8 +3454,18 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
break;
default:
internal_error ("unexpected expression %qE of kind %s", t,
get_tree_code_name (TREE_CODE (t)));
if (STATEMENT_CODE_P (TREE_CODE (t)))
{
/* This function doesn't know how to deal with pre-genericize
statements; this can only happen with statement-expressions,
so for now just fail. */
if (!ctx->quiet)
error_at (EXPR_LOCATION (t),
"statement is not a constant-expression");
}
else
internal_error ("unexpected expression %qE of kind %s", t,
get_tree_code_name (TREE_CODE (t)));
*non_constant_p = true;
break;
}

View File

@ -0,0 +1,9 @@
// PR c++/64701
// { dg-options "" }
enum { A };
void
foo ()
{
int x = ({ do {} while (0); A; });
}