From what cppref says about value initialization
if T is a class type with no default constructor or with a user-provided or deleted default constructor, the object is default-initialized;
But since that class type has deleted default constructor, how could the object be default-initialized?
As far as I know, default initialization of class type needs the access of default constructor. If we have:
struct A {
A() = delete;
int k;
};
Then A *a = new A;
will fail, so does A* a = new A();
.
But A a{};
is OK. But why? According to cppreference
Otherwise, If the braced-init-list is empty and T is a class type with a default constructor, value-initialization is performed.
A a{}
could work here. – scottxiaofoo f{10};
tofoo f{};
. – Richard Critten