public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55655] New: cannot export specialized template
@ 2012-12-11 20:15 mw_triad at users dot sourceforge.net
  2012-12-11 20:49 ` [Bug c++/55655] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mw_triad at users dot sourceforge.net @ 2012-12-11 20:15 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55655

             Bug #: 55655
           Summary: cannot export specialized template
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mw_triad@users.sourceforge.net


Let us say I have a generic template class, e.g. my_smart_ptr. Let us also say
I have a class 'foo', 'clas foo : public my_smart_ptr<bar>' that is part of
some library public API. And last, let us say that 'foo' needs to specialize
'my_smart_ptr<bar>'.

As far as I can tell, it is impossible to export this instantiation with proper
symbol visibility in this configuration. I do NOT want to make all possible
instantiations of my_smart_ptr have default visibility (someone, somewhere may
have an instantiation that should have hidden visibility).

I need to do two things, but they are mutually contradictory:
1. I need to explicitly instantiate the template in order to give it default
visibility. However, if I do this first, it prevents specialization. (I also
get compiler errors for my specific use case, as generic instantiation is not
possible.)
2. I need to declare specialization prior to instantiation. However, if I do
this before instantiation, I cannot set default visibility on the instantiation
and I get link errors.

I think there should be a way to do this... Right now I am forced to not export
the template, requiring each user to use their own instantiation, which creates
a fragile ABI.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-11 23:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-11 20:15 [Bug c++/55655] New: cannot export specialized template mw_triad at users dot sourceforge.net
2012-12-11 20:49 ` [Bug c++/55655] " redi at gcc dot gnu.org
2012-12-11 21:06 ` mw_triad at users dot sourceforge.net
2012-12-11 21:49 ` redi at gcc dot gnu.org
2012-12-11 23:34 ` mw_triad at users dot sourceforge.net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).