[LC++]g++ thinks default-constructed object is actually a function

Filipe Sousa filipe.gr.sousa at alunos.ipb.pt
Wed Apr 7 17:45:02 UTC 2004


On Wednesday 07 April 2004 03:56, Dr Mark H Phillips wrote:
> Hi,
>
> I know that if we do:
>
>   Apple apple();
>
> then C++ interprets apple as a function taking no arguments and
> returning an Apple object.  If we actually wanted apple to
> be an Apple object, constructed using the default constructor,
> then we should have done:
>
>   Apple apple;
>
> But I've come across a situation where g++ (version 3.2.2) thinks
> I'm trying to define a function when really I'm trying to use
> a default constructor --- but in this situation just leaving off
> the brackets doesn't help!
>
> I've attached the example program.  I'd be interested in people's
> ideas.
>
> Thanks,
>
> Mark.

I tried this with Intel Compiler 8.0 and it compiles without any problems. If 
you think this is a bug with g++ you should submit a bug report.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://lists.linux.org.au/pipermail/tuxcpprogramming/attachments/20040407/214d4e46/attachment.pgp 


More information about the tuxCPProgramming mailing list