can't specify templated member function with <>
Martin von Loewis
martin@mira.isdn.cs.tu-berlin.de
Sun Oct 25 13:58:00 GMT 1998
> I'm forced to add a dummy const F& argument, below, to the templated
> member function because I can't specify it with <fun>. Is this correct
> behavior?
Thanks for your report. This is a known problem; g++ incorrectly
considers the opening '<' as a comparison operator.
> x.iterate<fun>(f); // gets a "parse error before `>'"
You can write this as
x.template iterate<fun>(f);
instead (which is also standard C++ - if you define f somewhere :-)
I think this also qualifies as a frequently-reported bug.
Regards,
Martin
More information about the Gcc-bugs
mailing list