aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-04-30 10:23:11 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-04-30 10:23:11 -0400
commit4f419f8cdc734f82c04c3bc36659185912458998 (patch)
treea895b2142a5c67b6f0e76c3d9d371d6e9f029774 /gcc
parent8df07a2c14eafd6b3b52b2126c4e58b4107ea784 (diff)
downloadgcc-4f419f8cdc734f82c04c3bc36659185912458998.zip
gcc-4f419f8cdc734f82c04c3bc36659185912458998.tar.gz
gcc-4f419f8cdc734f82c04c3bc36659185912458998.tar.bz2
re PR c++/60951 ([C++11] ICE with braced-init-list assignment and constexpr constructor)
PR c++/60951 * typeck2.c (massage_init_elt): Use maybe_constant_init. From-SVN: r209933
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck2.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-aggr1.C17
3 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c4be5bd..a387883 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/60951
+ * typeck2.c (massage_init_elt): Use maybe_constant_init.
+
2014-04-30 Marek Polacek <polacek@redhat.com>
* typeck.c (cp_build_binary_op): Call ubsan_instrument_division
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 5bbc2ef..044d971 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1138,7 +1138,7 @@ massage_init_elt (tree type, tree init, tsubst_flags_t complain)
/* When we defer constant folding within a statement, we may want to
defer this folding as well. */
tree t = fold_non_dependent_expr_sfinae (init, complain);
- t = maybe_constant_value (t);
+ t = maybe_constant_init (t);
if (TREE_CONSTANT (t))
init = t;
return init;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-aggr1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-aggr1.C
new file mode 100644
index 0000000..7e4da11
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-aggr1.C
@@ -0,0 +1,17 @@
+// PR c++/60951
+// { dg-do compile { target c++11 } }
+
+struct Foo {
+ constexpr Foo(int x = 0) : memb(x) {}
+ int memb;
+};
+
+struct FooContainer {
+ Foo foo[2];
+};
+
+void fubar() {
+ int nonConst = 0;
+ FooContainer fooContainer;
+ fooContainer = { { 0, nonConst } };
+}