C++ direct list initialization with deleted default constructor
问题 I have the following class definition. I included a private x to make sure it is not an aggregate. class A { private: int x; public: A() = delete; A(std::initializer_list<int>) { printf("init\n"); } }; Now if I initialize this object with A a = A{} , it will say A::A() is deleted. I guess it is trying to call A::A() but it is deleted. If I comment out that line, so A::A() is automatically generated. Then if I run this code, I could see that it is calling A::A(std::initializer_list<int>) ! And