On 4 January 2011 14:11, Klaus Rudolph wrote: > >> > Is my code wrong >> >> Yes. You need to define A::x. > > Grrr... so stupid! :-) > > Yes, you are right. I stumbled that only a few lines generates an error. Yes, > the compiler optimize them out if the access is direct. With -O3 > it compiles and links without errors also without having const int A::x;
In future please send questions like this to the gcc-h...@gcc.gnu.org mailing list, which is for help using gcc. This list is for discussing development *of* gcc, not using gcc, as described at http://gcc.gnu.org/lists.html There are several invalid bug reports related to this same question which give a bit more detail, e.g. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14404