Experience with g++ 4.8 and -frepo?

Jonathan Wakely jwakely@redhat.com
Wed Aug 27 12:34:00 GMT 2014


On 27/08/14 14:18 +0200, David Kastrup wrote:
> At any rate, I need to tell all compilation units that a specialization
>exists, and of course I can only define it in one compilation unit.

So declare it wherever needed (e.g. by putting it in a header):

template <> const char * Smob_base<Grob>::type_p_name;

And define it exactly once:

template <> const char * Smob_base<Grob>::type_p_name = "ly:grob?";


> And
>I was surprised that the respective incantations appear to exist only
>starting with C++11, with GCC providing them in C++98 mode already.
>I mean, template specializations are in C++ how long now?  20 years or
>so?  How did people manage before C++11?

I assume you're talking about the "extern template" syntax? Every
major compiler implemented that more than a decade ago, it just didn't
make it into a standard until 2011.

But that syntax is for declaring explicit instantiations, not
specializations. What you need is valid in C++98.

>At any rate, g++ -frepo appears to get me rid of that inconsistent
>specialization problem at the cost of tripping up libstdc++ usage (which
>never was problematic without -frepo).  Sometimes I wonder whether I am
>the only one using some software...  But maybe -frepo was pretty new in
>g++-4.8.

No, -frepo is ancient and bit-rotted and noone uses it now.



More information about the Libstdc++ mailing list