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 21:17:19 +0100
- Cc: Mark Mitchell <mark at codesourcery dot com>, gdr at codesourcery dot com, bkoz at nabi dot net, libstdc++ at gcc dot gnu dot org
- References: <200106111929.PAA08790@makai.watson.ibm.com>
>>>>> "David" == David Edelsohn <dje@watson.ibm.com> writes:
> Are multiple modules with
> template <typename T>
> int S<double>::i = 1;
This is not valid C++.
> template <typename T>
> int S<T>::i = 1;
> allowed? I would have thought that at least the former would produce a
> STRONG symbol in the data section.
No. The template definition itself does not generate anything. If it did
(i.e. for an implementation of export), it would be weak.
If something refers to, say, S<double>::i, an implicit instantiation is
generated from the template. This is also weak.
> Both of the examples produces references but no storage allocation
> in GCC 3.0. Without an assignment, both produce common symbols.
Yes, because we can't express a weak definition on AIX except for
zero-initialized things, so we don't emit anything.
> Is Mark's proposal that only
> template <typename T>
> int S<double>::i;
> was suppose to allocate storage?
No, his proposal is that no storage would be allocated with or without an
assignment.
Jason