This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Experience with g++ 4.8 and -frepo?
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: David Kastrup <dak at gnu dot org>
- Cc: libstdc++ at gnu dot org
- Date: Wed, 27 Aug 2014 13:33:51 +0100
- Subject: Re: Experience with g++ 4.8 and -frepo?
- Authentication-results: sourceware.org; auth=none
- References: <87fvgi6xn5 dot fsf at fencepost dot gnu dot org> <20140827105915 dot GA22778 at redhat dot com> <87bnr66s7q dot fsf at fencepost dot gnu dot org>
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.