This is the mail archive of the gcc-prs@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


The following reply was made to PR c++/10086; it has been noted by GNATS.

From: "Giovanni Bajo" <giovannibajo at libero dot it>
To: <gcc-gnats at gcc dot gnu dot org>,
	<gcc-bugs at gcc dot gnu dot org>,
	<chrisk at mysticlabs dot com>,
	<nobody at gcc dot gnu dot org>,
	<gcc-prs at gcc dot gnu dot org>
Cc:  
Subject: Re: c++/10086: static const int unresolved in ? : construct
Date: Sun, 16 Mar 2003 02:02:59 +0100

 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]