This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PR3042
- To: David Edelsohn <dje at watson dot ibm dot com>
- Subject: Re: PR3042
- From: Jason Merrill <jason_merrill at redhat dot com>
- Date: 11 Jun 2001 18:20:51 +0100
- Cc: Mark Mitchell <mark at codesourcery dot com>, gdr at codesourcery dot com, Gabriel dot Dos-Reis at cmla dot ens-cachan dot fr, bkoz at nabi dot net, libstdc++ at gcc dot gnu dot org
- References: <200106111657.MAA08948@makai.watson.ibm.com>
>>>>> "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