------- Comment #6 from redi at gcc dot gnu dot org  2010-03-30 11:19 -------
(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.

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

Reply via email to