PR3042

Jason Merrill jason_merrill@redhat.com
Mon Jun 11 10:23:00 GMT 2001


>>>>> "David" == David Edelsohn <dje@watson.ibm.com> writes:

> 	Is it valid C++ for a static class member to be instantiated with
> a value in more than one module?

>   template <class Z>
>   int Y<Z>::m = 1;

This is a definition of the template.  An explicit instantiation would look
like

  template <> int Y<int>::m;

A template definition has logically weak linkage.  An explicit
instantiation has logically strong linkage, though we use weak symbols for
them anyway to avoid linker issues.

So the answer to your question is no, but the answer for your example is
yes.

Jason



More information about the Libstdc++ mailing list