From: jason Date: Thu, 14 Apr 2016 20:14:38 +0000 (+0000) Subject: PR c++/70648 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b9786e352de6e66b853e3f602ea16b3f43067026;p=thirdparty%2Fgcc.git PR c++/70648 * constexpr.c (cxx_eval_store_expression): Also copy CONSTRUCTOR_NO_IMPLICIT_ZERO. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234989 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index feb38c2922f7..cba07aa166ae 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-04-14 Jason Merrill + + PR c++/70648 + * constexpr.c (cxx_eval_store_expression): Also copy + CONSTRUCTOR_NO_IMPLICIT_ZERO. + 2016-04-14 Martin Sebor PR c++/69517 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 37cc33659830..4abff2011f2e 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -3149,6 +3149,8 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, CONSTRUCTOR_ELTS (*valp) = CONSTRUCTOR_ELTS (init); TREE_CONSTANT (*valp) = TREE_CONSTANT (init); TREE_SIDE_EFFECTS (*valp) = TREE_SIDE_EFFECTS (init); + CONSTRUCTOR_NO_IMPLICIT_ZERO (*valp) + = CONSTRUCTOR_NO_IMPLICIT_ZERO (init); } else *valp = init; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist10.C new file mode 100644 index 000000000000..c12347dcc807 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist10.C @@ -0,0 +1,11 @@ +// PR c++/70648 +// { dg-do compile { target c++11 } } + +struct C +{ + template + constexpr C (...) : c { static_cast(0)... } {} + int c[1]; +}; + +static constexpr int b = C{}.c[0];