[Bug c++/47396] New: Link error when declare a constant reference to a class or struct static const member!
aishen944 at 163 dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 21 13:45:00 GMT 2011
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: unassigned@gcc.gnu.org
ReportedBy: aishen944@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
More information about the Gcc-bugs
mailing list