Hi! Seems callers of cxx_eval_constant_expression don't really like if it returns NULL, which is what cxx_eval_statement_list returns for empty STATEMENT_LIST. In statement expressions we treat those the same as (void) 0 or any other statement with void value.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2017-03-03 Jakub Jelinek <ja...@redhat.com> PR c++/79822 * constexpr.c (cxx_eval_statement_list): Treat empty ({ }) like ({ (void) 0; }). * g++.dg/cpp0x/constexpr-79822.C: New test. --- gcc/cp/constexpr.c.jj 2017-02-22 23:03:12.000000000 +0100 +++ gcc/cp/constexpr.c 2017-03-03 12:42:02.391773591 +0100 @@ -3725,8 +3725,9 @@ cxx_eval_statement_list (const constexpr { 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; --- gcc/testsuite/g++.dg/cpp0x/constexpr-79822.C.jj 2017-03-03 12:49:41.595614494 +0100 +++ gcc/testsuite/g++.dg/cpp0x/constexpr-79822.C 2017-03-03 12:50:51.753673495 +0100 @@ -0,0 +1,12 @@ +// 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; +} Jakub