Cppref states that value-initialization in C++ happens when
an object is constructed with an empty initializer.
Also, default-initialization happens when
an object is constructed with no initializer.
However, on the page for value-initialization, there is also the claim that
if T is a class type with a default constructor that is not user-declared (until C++11)neither user-provided nor deleted (since C++11) (that is, it may be a class with an implicitly-defined or defaulted default constructor), the object is zero-initialized and the semantic constraints for default-initialization are checked, and if T has a non-trivial default constructor, the object is default-initialized;
This tells me that there is a scenario, where an object
- constructed with an initializer
- that has an implicitly-defined or defaulted default constructor
- and the above constructor is not trivial (possible, for example, by having the object contain non-static members with default initializers),
that object ends up being default-initialized rather than value-initialized.
The page on default-initialization states that the only 3 scenarios where it happens is either when there's no initializer present, or a member is missing from the constructor initializer list. Doesn't the above contradict those statements?