GCC-2.95 misparses certain trivial code

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Tue Aug 31 22:45:00 GMT 1999


>     bar(foo(1,2)).print(cout);

Thanks for your bug report. This is a known bug; g++ thinks this is a
variable declaration; as in

      bar foo(1,2);

Yes, you can have parentheses around the variable in C++. Then, when
it sees the dot, it is confused.

The work-around is to add another pair of parentheses:

     (bar(foo(1,2))).print(cout);

The problem should disappear when the parser rewrite happens.

Regards,
Martin



More information about the Gcc-bugs mailing list