mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 13:31:04 +08:00
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
This commit is contained in:
parent
90d9a8e6ef
commit
345edb3701
@ -1,3 +1,9 @@
|
||||
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;
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
12
gcc/testsuite/g++.dg/cpp0x/constexpr-79822.C
Normal file
12
gcc/testsuite/g++.dg/cpp0x/constexpr-79822.C
Normal file
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user