Commit 345edb37 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/79822 (ICE with void statement expression)

	PR c++/79822
	* constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
	({ (void) 0; }).

	* g++.dg/cpp0x/constexpr-79822.C: New test.

From-SVN: r245925
parent 90d9a8e6
2017-03-06 Jakub Jelinek <jakub@redhat.com>
PR c++/79822
* constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like
({ (void) 0; }).
2017-03-06 Jason Merrill <jason@redhat.com>
Revert "Allow deduction guides to look into primary template."
......
......@@ -3725,8 +3725,9 @@ cxx_eval_statement_list (const constexpr_ctx *ctx, tree t,
{
tree_stmt_iterator i;
tree local_target;
/* In a statement-expression we want to return the last value. */
tree r = NULL_TREE;
/* In a statement-expression we want to return the last value.
For empty statement expression return void_node. */
tree r = void_node;
if (!jump_target)
{
local_target = NULL_TREE;
......
2017-03-06 Jakub Jelinek <jakub@redhat.com>
PR c++/79822
* g++.dg/cpp0x/constexpr-79822.C: New test.
2017-03-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/79894
......
// PR c++/79822
// { dg-do compile }
// { dg-options "" }
bool
foo ()
{
bool a = ({ }) && false; // { dg-error "could not convert" }
bool b = ({ ; }) && false; // { dg-error "could not convert" }
bool c = ({ (void) 1; }) && false; // { dg-error "could not convert" }
return a && b && c;
}
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