http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47396
Summary: Link error when declare a constant reference to a
class or struct static const member!
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: aishen...@163.com
if code like this:
struct test
{
static const int uri = 10;
};
int main(void)
{
const int &ref = test::uri;
}
errors:
[qiang@chenyq-fedora ~]$ g++ test.cc
/tmp/ccwzRULi.o: In function `main':
test.cc:(.text+0x8): undefined reference to `test::uri'
collect2: ld returned 1 exit status