------- Comment #4 from fabien dot chene at gmail dot com 2010-03-30 10:07 ------- (In reply to comment #3) > (In reply to comment #2) > > is it still invalid in c++0X ? > > Yes. > > > 5.3.4.15 has been revamped, and I no longer find a motif to reject such > > code. > > In C++0x the object is default-initialized, which for a class type means the > default constructor is called. In this code, the default constructor is > deleted, so the code will not compile. See 12.1/5
OK thanks. > > I think the following code is also invalid, according to 8.5.6 (c++03) / > > 8.5.8 > > (c++0x): > > > > struct A { int& i; }; > > void f () { new A; } > > Not quite: in C++0x the program doesn't call for default-initialization of > A::i, it calls for default-initialization of A, which is invalid because the > default constructor is deleted. OK, but it appears that the C++0X part is not yet implemented in GCC -- the constructor is not deleted in this case. Nevertheless, can you confirm that it is valid C++03 ? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25811