aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-06-27 01:11:53 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-06-27 01:11:53 +0100
commitdb9e7b2a12ca04b9928319f8b143b83bf2a1433c (patch)
tree2216e72a6fe1a214cd7feb007791a1e5dbbbd73d
parent3beb455a05d242e4fb077f35e76f9bb4675f68e4 (diff)
downloadgcc-db9e7b2a12ca04b9928319f8b143b83bf2a1433c.zip
gcc-db9e7b2a12ca04b9928319f8b143b83bf2a1433c.tar.gz
gcc-db9e7b2a12ca04b9928319f8b143b83bf2a1433c.tar.bz2
Declare some explicit instantiations for strings in Debug Mode
The empty reps and the I/O functions do not need to be implicitly instantiated to enable assertions, so declare the explicit instantiations when _GLIBCXX_EXTERN_TEMPLATE == -1 (i.e. when _GLIBCXX_ASSERTIONS is defined). PR libstdc++/86138 * include/bits/basic_string.tcc: [_GLIBCXX_EXTERN_TEMPLATE < 0] Declare explicit instantiations of COW empty reps and I/O functions. From-SVN: r262167
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc8
2 files changed, 10 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6e9ce61..0db12be 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-27 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/86138
+ * include/bits/basic_string.tcc: [_GLIBCXX_EXTERN_TEMPLATE < 0]
+ Declare explicit instantiations of COW empty reps and I/O functions.
+
2018-06-26 David Edelsohn <dje.gcc@gmail.com>
* testsuite/experimental/algorithm/sample-2.cc: Add TLS DejaGNU
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index 9fbea84..04b68ca 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1597,13 +1597,13 @@ _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
// The explicit instantiations definitions in src/c++11/string-inst.cc
// are compiled as C++14, so the new C++17 members aren't instantiated.
// Until those definitions are compiled as C++17 suppress the declaration,
// so C++17 code will implicitly instantiate std::string and std::wstring
// as needed.
-# if __cplusplus <= 201402L
+# if __cplusplus <= 201402L && _GLIBCXX_EXTERN_TEMPLATE > 0
extern template class basic_string<char>;
# elif ! _GLIBCXX_USE_CXX11_ABI
// Still need to prevent implicit instantiation of the COW empty rep,
@@ -1626,7 +1626,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
getline(basic_istream<char>&, string&);
#ifdef _GLIBCXX_USE_WCHAR_T
-# if __cplusplus <= 201402L
+# if __cplusplus <= 201402L && _GLIBCXX_EXTERN_TEMPLATE > 0
extern template class basic_string<wchar_t>;
# elif ! _GLIBCXX_USE_CXX11_ABI
extern template basic_string<wchar_t>::size_type
@@ -1646,7 +1646,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
basic_istream<wchar_t>&
getline(basic_istream<wchar_t>&, wstring&);
#endif // _GLIBCXX_USE_WCHAR_T
-#endif // _GLIBCXX_EXTERN_TEMPLATE > 0
+#endif // _GLIBCXX_EXTERN_TEMPLATE
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std