//#include <cstdio>
struct values
{
static const int one = 1;
};
struct counter
{
int n;
counter() : n(0) {}
counter&
operator,(int const&) { n++; return *this; }
};
int
main()
{
values vals;
counter cntr;
cntr, vals.one;
//std::printf("%d\n", cntr.n);
return 0;
}
g++ problem.cpp
/tmp/cc88FSiA.o: In function `main':
problem.cpp:(.text+0x19): undefined reference to `values::one'
collect2: ld returned 1 exit status
I'm getting the same failure with gcc 3.2, 4.1, 4.4, 4.5.0 20100109.
It works as expected with Visual C++ 9.0.
Is this a bug?
--
Summary: long-standing g++ bug?
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rwgk at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43594