> On Sun, Oct 16, 2005 at 02:02:09PM -0500, John Ratliff wrote: > > This seems like a definite bug. The fact that it works in 3.4.2 and not > in > > 3.3.3 seems like a probable bug to me, but I will ask this question in a > > standard C++ newsgroup so that someone intimately familiar with the > standard > > can give me a definitive answer, but I still think g++ 3.3 is wrong and > g++ > > 3.4 is right. > > > > If I were taking the address of the constant, sure, it would have to > have > > storage space and I wouldn't expect it any other way. > > > > I agree in that this is a weird behaviour, but I don't think it's > exactly a bug, unless it is mandatory for a compiler to try > everything possible before taking the address of a constant. Maybe > GCC 3.3 simply couldn't find a way to use the constants directly. On comp.lang.c++, Victor Bazarov says my example program is well-formed standard C++ according to the ISO C++ standard. "Since their address is never taken, the 'foo::A' and 'foo::B' are, in fact, compile-time constant expressions that do not require storage. The objects, therefore, don't need to be defined outside of the class definition. g++ 3.3.3 is probably too old. It's even too old and non- compliant in this particular case even with 1998 version of the C++ Standard. The standard was amended to allow const statics to be only defined in the class definition if their address is not taken _even_ if they are "used" outside the class. [I am too lazy, though, to look it up in the Standard...]" -- Victor Bazarov (comp.lang.c++) I am going to upgrade to g++ 3.4, but I think it is a g++ 3.3.3 and 3.3.5 bug. I should go see if 3.3.6 fixed this. Thanks, --John Ratliff