https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99566
Bug ID: 99566
Summary: designated initialization rejects explicit constructor
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
Reduced from StackOverflow (https://stackoverflow.com/q/66606143/2069064):
struct A {
explicit A(int);
};
struct B {
A a;
};
A a{10}; // ok
B b{.a{10}}; // error: converting from initializer list
// would use explicit constructor
But the initialization of the "a" subobject of B should work the same was as
the initialization of the complete object "a".