g++ bug report

Alexandre Oliva aoliva@redhat.com
Sat Jun 9 11:34:00 GMT 2001


On Jun  9, 2001, Oscar Fuentes <ofv@wanadoo.es> wrote:

> G++ fails to compile this valid code:

>   MyClass **p;
>   *p = new (MyClass*)[10];

Why do you think this is valid?  *p is indeed a MyClass*, whereas `new
(MyClass*)[10]' will return a pointer to the first element of the
array of MyClass*s, i.e., a MyClass**.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-bugs mailing list