aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-04-14 16:14:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-04-14 16:14:38 -0400
commit3ae9a8b765a5bbcdae187b79eb1f773582b342e1 (patch)
tree593932ef9d80b1e1b8d1495c5a2d49a9c7f04730
parentbc773aad990ae44b6adfbd602c1cd0cbbeabd5ca (diff)
re PR c++/70648 (adplug-xmms fails to compile)
PR c++/70648 * constexpr.c (cxx_eval_store_expression): Also copy CONSTRUCTOR_NO_IMPLICIT_ZERO. From-SVN: r234989
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/constexpr.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-initlist10.C11
3 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index feb38c2922f..cba07aa166a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-04-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/70648
+ * constexpr.c (cxx_eval_store_expression): Also copy
+ CONSTRUCTOR_NO_IMPLICIT_ZERO.
+
2016-04-14 Martin Sebor <msebor@redhat.com>
PR c++/69517
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 37cc3365983..4abff2011f2 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 00000000000..c12347dcc80
--- /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 <class... U>
+ constexpr C (...) : c { static_cast<U &&>(0)... } {}
+ int c[1];
+};
+
+static constexpr int b = C{}.c[0];