Affected subclause: [dcl.init.aggr]
Change: A class that has user-declared constructors is never an aggregate
. Rationale: Remove potentially error-prone aggregate initialization
which may apply notwithstanding the declared constructors of a class
. Effect on original feature: Valid C++ 2017 code that aggregate-initializes
a type with a user-declared constructor
may be ill-formed or have different semantics
in this revision of C++
. For example:
struct A {
A() = delete;
};
struct B {
B() = default;
int i = 0;
};
struct C {
C(C&&) = default;
int a, b;
};
A a{};
B b = {1};
auto* c = new C{2, 3};
struct Y;
struct X {
operator Y();
};
struct Y {
Y(const Y&) = default;
X x;
};
Y y{X{}};