http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52688
--- Comment #6 from Sarfaraz Nawaz <sir_nawaz959 at yahoo dot com> 2012-03-26 15:54:46 UTC --- (In reply to comment #5) > (In reply to comment #0) > > While gcc-4.5.1 compiles fine this code > > Are you sure? I get the same error with 4.1.2, 4.4.3, 4.5.2, 4.6.3 and 4.7.0 > > 4.5.2 compiles and links OK with optimisation enabled, but so do the other > versions I used ideone.com to compile it, which uses gcc-4.5.1 with -std=c++0x. http://ideone.com/Y2vIF I just noticed that though it compiles and links fine, but it doesn't print the expected output. :| Interestingly, when I remove `const` from the definition of the static local variable, and then I attempt to change it from the local class, it then gives error: http://ideone.com/vvwRc :-)