Message ID | CAEwic4aaeJZ7xFnRabCHanosMzTcf-=EGHPXRv-7x8L2EU8VOw@mail.gmail.com |
---|---|
State | New |
Headers | show |
OK. Jason
Hi, On 12/12/2014 11:58 AM, Kai Tietz wrote: > New testcase in g++.dg/cpp1y as pr63996.C > > // { dg-do compile { target c++14 } } > > constexpr int > foo (int i) > { > int a[i] = { }; > } > > constexpr int j = foo (1); // { dg-error "is not a constant expression" } The testcase fails spuriously because of Jason's VLA reversion commit, please adjust it. Thanks, Paolo.
Kai Tietz <ktietz70@googlemail.com> writes: > New testcase in g++.dg/cpp1y as pr63996.C > > // { dg-do compile { target c++14 } } > > constexpr int > foo (int i) > { > int a[i] = { }; > } > > constexpr int j = foo (1); // { dg-error "is not a constant expression" } FAIL: g++.dg/cpp1y/pr63996.C -std=c++14 (test for excess errors) Excess errors: /usr/local/gcc/gcc-20141214/gcc/testsuite/g++.dg/cpp1y/pr63996.C:6:10: error: ISO C++ forbids variable length array 'a' [-Wvla] Andreas.
Index: constexpr.c =================================================================== --- constexpr.c (Revision 218570) +++ constexpr.c (Arbeitskopie) @@ -2841,7 +2870,7 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree { cxx_eval_statement_list (ctx, body, non_constant_p, overflow_p, jump_target); - if (returns (jump_target) || breaks (jump_target)) + if (returns (jump_target) || breaks (jump_target) || *non_constant_p) break; } if (breaks (jump_target))