My recently added checking code to make sure that we didn't miss calling
reshape_init for an aggregate initializer wasn't limiting itself to
aggregate classes.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit bb4c1b72737952ae714f1586c0577f62b39337bc
Author: Jason Merrill <ja...@redhat.com>
Date: Wed Jun 24 16:31:13 2015 -0400
PR c++/66654
* typeck2.c (digest_init_r): Only expect reshaping if the class is
aggregate.
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 30d93ed..7597de1 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1095,7 +1095,8 @@ digest_init_r (tree type, tree init, bool nested, int flags,
if (cxx_dialect >= cxx11
&& BRACE_ENCLOSED_INITIALIZER_P (init)
&& CONSTRUCTOR_NELTS (init) == 1
- && (CLASS_TYPE_P (type) || VECTOR_TYPE_P (type)))
+ && ((CLASS_TYPE_P (type) && !CLASSTYPE_NON_AGGREGATE (type))
+ || VECTOR_TYPE_P (type)))
{
tree elt = CONSTRUCTOR_ELT (init, 0)->value;
if (reference_related_p (type, TREE_TYPE (elt)))
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-list4.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-list4.C
new file mode 100644
index 0000000..fe5be07
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-list4.C
@@ -0,0 +1,9 @@
+// PR c++/66654
+// { dg-do compile { target c++11 } }
+
+class A {
+ A();
+};
+class B {
+ A r{r};
+};