[PATCH] Disable std::string and std::wstring extern templates for C++17

Jonathan Wakely jwakely@redhat.com
Mon Aug 1 16:06:00 GMT 2016


As I mentioned last week, the explicit instantiation definitions for
std::string and std::wstring are compiled as C++11, so do not
instantiate the new member functions added for C++17.

Rather than change what we instantiate and export from the library I'd
prefer to suppress the explicit instantiation declarations for C++17.
Once C++17 is stable and we know which new symbols are needed we can
decide whether to change how we compile the instantiations, and add
new exports to the linker script.

	* include/bits/basic_string.tcc: Disable explicit instantiation
	declarations for C++17.

Tested powerpc64-linux, committed to trunk.


-------------- next part --------------
commit 248b39f993ea5f1fcc9668e38b7683e58c0facb8
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Aug 1 16:28:09 2016 +0100

    Disable std::string and std::wstring extern templates for C++17
    
    	* include/bits/basic_string.tcc: Disable explicit instantiation
    	declarations for C++17.

diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 2b6644d..0560b46 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1569,7 +1569,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // Inhibit implicit instantiations for required instantiations,
   // which are defined via explicit instantiations elsewhere.
-#if _GLIBCXX_EXTERN_TEMPLATE > 0
+#if _GLIBCXX_EXTERN_TEMPLATE > 0 && __cplusplus <= 201402L
   extern template class basic_string<char>;
   extern template
     basic_istream<char>&


More information about the Gcc-patches mailing list