Closed Kojoley closed 2 years ago
@djowel I've fixed the CI if that was blocking the merge.
Why not handle the warning? I failed to reproduce the warning with a simple example only deleting the assignment operator and found that is_pod
still yields true when the default constructor is defaulted: https://godbolt.org/z/oaE8ndE3x
From [dcl.init.aggr] p1:
An aggregate is an array or a class ([class]) with
- no user-declared or inherited constructors ([class.ctor]),
From [diff.cpp17] p3:
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 { // not an aggregate; previously an aggregate A() = delete; }; struct B { // not an aggregate; previously an aggregate B() = default; int i = 0; }; struct C { // not an aggregate; previously an aggregate C(C&&) = default; int a, b; }; A a{}; // ill-formed; previously well-formed B b = {1}; // ill-formed; previously well-formed auto* c = new C{2, 3}; // ill-formed; previously well-formed struct Y; struct X { operator Y(); }; struct Y { // not an aggregate; previously an aggregate Y(const Y&) = default; X x; }; Y y{X{}}; // copy constructor call; previously aggregate-initialization
Clang 13 now also emits
-Wdeprecated-copy
when a copy assign operator is deleted. Since we need bothactor
to be an aggregate and to disallow assignment -- the only other way is to suppress the warning.