This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PR3042


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]