PR c++/26997 g++ reports misleading error message when the identifier with error occurs earlier on the same line
Mark Mitchell
mark@codesourcery.com
Tue Oct 28 10:23:00 GMT 2008
Manuel López-Ibáñez wrote:
> 2008/10/28 Mark Mitchell <mark@codesourcery.com>:
>> (X) ; // Not a cast.
>> (X) 3 ... // A cast.
>
> What about ?
> (C())*var;
>
> or
>
> (C())+var;
>
> We currently parse the above as casts. Is that correct?
I believe so, yes.
> If I understand correctly (C()) followed by comma, semicolon, period,
> '->' or unambiguous binary operator must be a call to constructor,
> anything else must be a cast. Am I right?
I think that's correct, with the exception of the statement-expression
case already handled by the parser. I hesitate to make absolute
statements about these things because there are so many corner cases,
but I can't think of an example where your rule is incorrect. As a
first cut, you could try implementing it and running the testsuite.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
More information about the Gcc-patches
mailing list