
11 Feb
2005
11 Feb
'05
1:03 a.m.
The following bit of code gives me an undefined symbol (l1) when using gcc 3.2.2-5.8. Is there something wrong with the code or is there a bug in the compiler or a setting I don't know about, etc? struct S { static const short l1 = 10; }; void go(const short& l) {}; // causes undefined symbol l1 int main(int argc, char* argv[]) { go(S::l1); return 0; } If I do normal, non-in-class-initialization, the problem doesn't appear nor does it appear if I accept the short by value in go. Thanks, John