This is the mail archive of the gcc-bugs@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: c++/10086: static const int unresolved in ? : construct


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=10086

I'm not sure what it is going on. I know that the standard says that you
still have to define an initialized static const member (even if there is an
open defect report about this, I believe). But then, why this should work:

struct Foo
{
   static const int A = 0;
};

int main(void)
{
   return Foo::A;
}

This one compiles and links correctly on G++ 3.2, but it should not. The
poster reported a simple case when just defining a local variable to mirror
the contents of the static const member changes the compilation failure into
a success. IMO there is an issue here (probably related to the optimized
which is stripping away the symbol in some situations, thus avoiding the
linker error).

Giovanni Bajo


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