On 7 November 2011 22:38, Gabriel Dos Reis wrote: >> Unfortunately this doesn't work very well in C++11 mode, as defaulted >> constructors don't cause warnings when they should do e.g. >> >> struct C >> { >> int i; >> C() = default; >> }; >> >> This doesn't produce the same warning as C() {} even though that's >> what the defaulted constructor is equivalent to. > > so the defaulted constructor does not initialize C::i?
[class.ctor] p6 A default constructor that is defaulted and not defined as deleted is implicitly defined when it is odr-used (3.2) to create an object of its class type (1.8) or when it is explicitly defaulted after its first declaration. The implicitly-defined default constructor performs the set of initializations of the class that would be performed by a user-written default constructor for that class with no ctor-initializer (12.6.2) and an empty compound-statement.