It would be nice to have a linter/tidy/whatever to enforce all non-defaulted fields in an aggregate type are initialized.
Assuming the code:
struct A {
struct Options {
unsigned cache_size;
signed delta;
bool in_memory = false;
};
A(const Options&) {} // unsafe (may have fields uninitialized)
A(unsigned cache_size, signed delta, bool in_memory = false) {} // safe, all non-default args are initialized
};
int main() {
(void)A{
A::Options{
.delta = -1,
},
};
}
This leaves cache_size uninitialized when using designated initializers. (The problem exists even without designated initializers, but with designated initializers recently enabled it seems likely that we'll increase the use of aggregate types)