> > I'm forwarding this message from a coworker. > He ran into this regression bug with GCC 4.0.1 (it works correctly in > 3.4.1). > The conditional operator expression isn't handling static consts > correctly resulting in linker errors since it is trying to resolve to > statics that were never defined. > > struct Foo > { > static const int a = 1; > static const int b = 2; > }; > > > inline void foo(bool v) > { > std::cout << ((v) ? (Foo::a) : (Foo::b)); > }
This is not a bug. You still need to do: const int Foo::a; const int Foo::b; For this to be valid C++. -- Pinski