------- Comment #5 from vz-gcc at zeitlins dot org  2006-02-19 16:50 -------
In reply to comment 4: I do realize that adding an initializer fixes the
problem. But what to do if the static member is an object of a class which only
has a default ctor? E.g.

enum V { V1, V2, V3 };

struct Int { Int() : x(0) { } int x; };
template <V v> struct Data { static Int Value; };

template struct Data<V1>;
template <> Int Data<V1>::Value;

int main() { return Data<V1>::Value.x; }


How to fix this example to link?

Note that the above (with or without the explicit instantiation) is just fine
for Intel and Comeau compilers (and g++ < 4 of course) but not g++ 4.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26355

Reply via email to