This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33161] New: Undefined symbols at link for referenced static const data member
- From: "sylvain dot pion at sophia dot inria dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Aug 2007 11:54:24 -0000
- Subject: [Bug c++/33161] New: Undefined symbols at link for referenced static const data member
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiling the following program, with "g++ A.cpp" fails to link
with the following error message :
/tmp/ccehheUK.o:(.rodata+0x0): undefined reference to `A::x'
collect2: ld returned 1 exit status
------------------------
struct A {
static const int x = 0;
};
const int & i = A::x;
int main() {}
------------------------
It can be reproduced with g++ versions ranging from 3.2 to 4.3,
on Linux and Darwin.
Note that changing one "int" to "unsigned" makes it pass.
Is this really expected to fail ?
--
Summary: Undefined symbols at link for referenced static const
data member
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sylvain dot pion at sophia dot inria dot fr
GCC host triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33161