This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Funnies about C++ parsing - unhelpful error messages
- From: "Giovanni Bajo" <rasky at develer dot com>
- To: "Florian Weimer" <fw at deneb dot enyo dot de>
- Cc: "Richard Guenther" <rguenth at tat dot physik dot uni-tuebingen dot de>,<gcc-patches at gcc dot gnu dot org>,<giovannibajo at libero dot it>
- Date: Fri, 3 Sep 2004 16:02:17 +0200
- Subject: Re: Funnies about C++ parsing - unhelpful error messages
- References: <Pine.LNX.4.44.0408311203160.9036-100000@alwazn.tat.physik.uni-tuebingen.de><08dd01c49047$5751e880$f503030a@mimas> <87ekllagio.fsf@deneb.enyo.de>
Florian Weimer wrote:
> * Giovanni Bajo:
>
>>> Bar<Foo<FooBar<int> > >(FooBar<int>()).operator()(x); // 21
>>> }
>>
>> This is correct. Another way of writing this without the explicit call
would
>> be:
>>
>> ((Bar<Foo<FooBar<int> > >) (FooBar<int>())) (x);
>
> This seams to be another possibility:
>
> static_cast<Bar<Foo<FooBar<int> > > >(FooBar<int>())(x);
Yes, even if it is slightly different from the above because it does not
work if the constructor is explicit.
Giovanni Bajo