This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21832] New: Linker error when taking reference of static integral data member
- From: "bernie at develer dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 May 2005 21:44:21 -0000
- Subject: [Bug c++/21832] New: Linker error when taking reference of static integral data member
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Also happens with 3.3.5 and 4.0.0. The test case
is so simple I'm surprised nobody noticed before.
Unless of course I need to take a new C++ course.
---cut---
void bar(const int &a) { }
struct Foo
{
static const int X = 10;
};
int main()
{
bar(Foo::X);
return 0;
}
---cut---
/tmp/ccYC57Zg.o(.text+0x23): In function `main':
foo.cpp: undefined reference to `Foo::X'
collect2: ld returned 1 exit status
--
Summary: Linker error when taking reference of static integral
data member
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bernie at develer dot com
CC: aleph at develer dot com,gcc-bugs at gcc dot gnu dot
org,giovannibajo at libero dot it
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21832