------- Comment #7 from fabien dot chene at gmail dot com 2010-03-31 07:06 ------- (In reply to comment #6) > (In reply to comment #5) > > > Nevertheless, can you confirm that it is valid C++03 ? > > > > I mean invalid, sorry. > > Yup :-) > > It is invalid. A is a non-POD class type, so 5.3.4/15 says the new-expression > without a new-initializer causes the object to be default-initialized, which > causes a default constructor to be implicitly-defined with an empty > mem-initializer list (12.1/7) which is ill-formed by 8.5/5 because the > reference member is not initialized. > > > In C++03 the cases of Foo and A are slightly different, "new Foo" is > ill-formed > according to 5.3.4/15 and "new A" is ill-formed as described above.
Thanks for the clarification ! Patch here for the non C++0X part: http://gcc.gnu.org/ml/gcc-patches/2010-03/msg01467.html > In C++0x both "new Foo" and "new A" result in a call to a deleted constructor. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25811