+2019-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/92869
+ * class.c (finish_struct): For C++17 and earlier, check
+ type_has_user_provided_or_explicit_constructor rather than
+ TYPE_HAS_USER_CONSTRUCTOR whether to set CLASSTYPE_NON_AGGREGATE.
+
2019-12-11 Marek Polacek <polacek@redhat.com>
PR c++/92878 - Parenthesized init of aggregates in new-expression.
/* Remember current #pragma pack value. */
TYPE_PRECISION (t) = maximum_field_alignment;
- if (TYPE_HAS_USER_CONSTRUCTOR (t))
+ if (cxx_dialect < cxx2a)
+ {
+ if (!CLASSTYPE_NON_AGGREGATE (t)
+ && type_has_user_provided_or_explicit_constructor (t))
+ CLASSTYPE_NON_AGGREGATE (t) = 1;
+ }
+ else if (TYPE_HAS_USER_CONSTRUCTOR (t))
CLASSTYPE_NON_AGGREGATE (t) = 1;
/* Fix up any variants we've already built. */
+2019-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/92869
+ * g++.dg/cpp0x/aggr3.C: New test.
+
2019-12-11 Marek Polacek <polacek@redhat.com>
PR c++/92878 - Parenthesized init of aggregates in new-expression.
--- /dev/null
+// PR c++/92869
+// { dg-do compile { target c++11 } }
+
+struct A {
+ A () = default;
+ A (const A &) = default;
+ A (A &&) = default;
+ int arr[3];
+};
+
+template <typename T, int N>
+struct B {
+ B () = default;
+ B (const B &) = default;
+ B (B &&) = default;
+ T arr[N];
+};
+
+A a = { { 1, 2, 3 } }; // { dg-error "could not convert" "" { target c++2a } }
+B<int, 3> b = { { 1, 2, 3 } }; // { dg-error "could not convert" "" { target c++2a } }