when was const-behavior fixed in GCC (or was it never broken)?
From posts here in GameDev awhile back, I had thought that this was legal C++:
struct foo
{
int bar;
void call( void ) const { ++bar; }
};
Apparently this is not the case (as I found out in my line-number incrementing function, which needs to be const for boost to bind to it without pages of compile errors). I believe it may have compiled on G++ 3.3.1, but after automatic updates on my debian box, and an accidental update on my cygwin box messing with the freetype installation (3.3.3 on my windows machine, 3.3.4 on my debain box), this generates an error! I'd like to make sure that I'm not hallucinating or something, so, can someone tell me what version of G++ this code became non-compiling?
If it was recent, for those who are curious as to the solution to this dilemma, simply add the keyword mutable to bar:
mutable int bar;
(however, since boost passes around by value (as I frogot when designing this code), I need to use static or a reference anyways)
I found this out in a GCC 3.5 bugreport I found on [google], where the keyword was only being applied to the first variable in a multi-decleration line ala:
mutable int foo,bar; //mutable only applied to foo although it should be applied to both
(That might be fixable via typedef or typeof(mutable int) - I didn't read too far into it after I found my solution).
[Edited by - MaulingMonkey on October 24, 2004 10:00:18 AM]