This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with object initialization


On Fri, Feb 22, 2008 at 12:29 PM, Rodolfo Schulz de Lima
<rodolfo@rodsoft.org> wrote:
> Hi, I'd like to know why this rather simple code doesn't compile on gcc
>  (from 4.2 to 4.3, haven't tested on earlier compilers):
This is not the correct mailing list for this really, please use
gcc-help@ or in this case a C++ language list.

>  Now... why the compiler assumed that I'm defining a function returning
>  'test' and accepting a pointer to a function returning 'data'? If I
>  wanted this, I'd write: test a(data(*)()), isn't it? What's the catch?

Because of an ambiguous in the C++ syntax, the C++ standard decided
that this will be a function named a returning the type test and
taking an argument of the type data.

This is not a bug in GCC or the C++ standard either.

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]