This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fwd: GCC 4.0 bug]


> 
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]