It uses the default constructor because initializing a list with {} should be a short form of initializing a value always, without considering other constructors, even if they are constructors of an initializer list.
Is it necessary to distinguish the following two constructions: ...
X() always initialized with a value, and X{} is only the initialization of the value if X has a default constructor. If it is an aggregate, then X{} represents aggregate initialization (initialization of elements of X to {} recursive). If it has only initializer list constructors and default constructors, then X() is invalid and X{} may be valid
struct A { A(initializer_list<int>); }; A a = A{};
Essentially, that X{} really depends on what X But X() always initializes the value.
... or return X (); vs return {};
Something subtle to mention ... In return {} target is initialized with a list-list, and in return X(); first, the line initializes X But even though it is initialized using the list of copies, it can use the default constructor explicit by default, since initializing the value does not care about explicit . However, when you execute return {} and try to use an explicit constructor other than the standard, you will be mistaken
struct A { explicit A(initializer_list<int>); }; A f() { return {}; }
source share