This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Darwin] Patch c++/15428
On May 20, 2004, at 2:04 PM, Jason Merrill wrote:
I still don't see why. You explained above why this is necessary if
there's a previous extern instantiation, but in that case we already do
explicit instantiations on all targets.
If so, then I missed something! (Always possible.) When I did my
original linkonce work for Darwin, I didn't find any logic that treated
this case specially. Here's what we had in 3.4, for example:
/* The explicit instantiation of a class template specialization
implies the instantiation of all of its members not
previously explicitly specialized in the translation unit
containing the explicit instantiation.
Of course, we can't instantiate member template classes, since
we don't have any arguments for them. Note that the standard
is unclear on whether the instantiation of the members are
*explicit* instantiations or not. We choose to be generous,
and not set DECL_EXPLICIT_INSTANTIATION. Therefore, we allow
the explicit instantiation of a class where some of the members
have no definition in the current translation unit. */
if (! static_p)
for (tmp = TYPE_METHODS (t); tmp; tmp = TREE_CHAIN (tmp))
if (TREE_CODE (tmp) == FUNCTION_DECL
&& DECL_TEMPLATE_INSTANTIATION (tmp))
{
mark_decl_instantiated (tmp, extern_p);
repo_template_instantiated (tmp, extern_p);
if (! extern_p)
instantiate_decl (tmp, /*defer_ok=*/1);
In mainline, in do_type_instantiation, we have the
explicitly_instantiate_members test. But that's something that I added
for Darwin, and what we're discussing now is whether I got it right. I
think what I'm hearing you say is that some other part of the compiler
does the same test, so all that logic in do_type_instantiation never
had to go in in the first place, and it can be removed, not fixed. Can
you point me to that other place that does the same test?
--Matt