struct TT1 {
static int v1;
static int v2;
};
int TT1::v1;
int TT1::v2 = 3;
template<typename U> struct TT2 {
static int v1;
static int v2;
};
template<> int TT2<bool>::v1;
template<> int TT2<bool>::v2 = 3;
int main() {
TT1 v;
v.v1 = 0;
v.v2 = 0;
TT2<bool> vt;
vt.v1 = 0;
vt.v2 = 0;
}
gets you:
/tmp/cccfsd6q.o(.text+0x32): In function `main':
: undefined reference to `TT2<bool>::v1'
collect2: ld returned 1 exit status
Note that only one of the four definitions is not found.
Ivan
--
Summary: Fails to link
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22365