@@ -5571,7 +5571,9 @@ check_bases_and_members (tree t)
Again, other conditions for being an aggregate are checked
elsewhere. */
CLASSTYPE_NON_AGGREGATE (t)
- |= (type_has_user_provided_or_explicit_constructor (t)
+ |= ((cxx_dialect < cxx2a
+ ? type_has_user_provided_or_explicit_constructor (t)
+ : TYPE_HAS_USER_CONSTRUCTOR (t))
|| TYPE_POLYMORPHIC_P (t));
/* This is the C++98/03 definition of POD; it changed in C++0x, but we
retain the old definition internally for ABI reasons. */
@@ -61,6 +61,8 @@ struct K { int a, b; virtual void foo ()
struct L : virtual public A { int d, e; };
struct M : protected A { int d, e; };
struct N : private A { int d, e; };
+struct O { O () = delete; int a, b, c; };
+struct P { P () = default; int a, b, c; };
typedef int T;
typedef float U;
typedef int V __attribute__((vector_size (4 * sizeof (int))));
@@ -94,6 +96,13 @@ main ()
assert (NTEST (L));
assert (NTEST (M));
assert (NTEST (N));
+#if __cplusplus > 201703L
+ assert (NTEST (O));
+ assert (NTEST (P));
+#else
+ assert (PTEST (O));
+ assert (PTEST (P));
+#endif
assert (PTEST (int[]));
assert (PTEST (double[]));
assert (PTEST (T[2]));
@@ -114,4 +123,6 @@ main ()
assert (PTEST (L[]));
assert (PTEST (M[6]));
assert (PTEST (N[]));
+ assert (PTEST (O[]));
+ assert (PTEST (P[]));
}
@@ -23,7 +23,9 @@ struct B
int main()
{
A a1, a2;
+#if __cplusplus <= 201703L
B b = {1};
+#endif
a1 = a2;
}
@@ -6,4 +6,4 @@ struct A {
A() = delete;
};
-A a = {1};
+A a = {1}; // { dg-error "could not convert" "" { target c++2a } }
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++11 } }
+struct A {
+ A () = delete; // { dg-message "declared here" "" { target c++2a } }
+};
+struct B {
+ B () = default;
+ int b = 0;
+};
+struct C {
+ C (C&&) = default; // { dg-message "candidate" "" { target c++2a } }
+ int c, d;
+};
+A a {}; // { dg-error "use of deleted function" "" { target c++2a } }
+B b = {1}; // { dg-error "could not convert" "" { target { c++11_only || c++2a } } }
+C *c = new C {2, 3}; // { dg-error "no matching function for call to" "" { target c++2a } }
@@ -0,0 +1,25 @@
+// { dg-do run { target c++11 } }
+
+struct A;
+struct B { operator A (); };
+struct A { A (const A &) = default; A () = default; B a; };
+A a {B {}};
+bool seen;
+
+B::operator A ()
+{
+ seen = true;
+ return A ();
+}
+
+int
+main ()
+{
+#if __cplusplus > 201703L
+ if (!seen)
+ __builtin_abort ();
+#else
+ if (seen)
+ __builtin_abort ();
+#endif
+}