re PR libstdc++/56193 (ios_base should replace operator void* with explicit operator...
authorJonathan Wakely <jwakely@redhat.com>
Wed, 24 Sep 2014 22:13:35 +0000 (23:13 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 24 Sep 2014 22:13:35 +0000 (23:13 +0100)
PR libstdc++/56193
* config/abi/pre/gnu.ver: Add new exports.
* include/bits/basic_ios.h (basic_ios::operator bool): Define.
* src/c++98/ios_locale.cc (basic_ios::operator void*): Instantiate.

From-SVN: r215571

libstdc++-v3/ChangeLog
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/include/bits/basic_ios.h
libstdc++-v3/src/c++98/ios_locale.cc

index 5f53cddd2f8a2b3c121bd5dd8eced8000be18107..34a3d003eb1edc46518b769ac8ac9b4212a6499e 100644 (file)
@@ -3,6 +3,11 @@
        * config/abi/pre/gnu.ver: Make GLIBCXX_3.4 patterns stricter so the
        new GLIBCXX_3.4.21 symbols don't match them.
 
+       PR libstdc++/56193
+       * config/abi/pre/gnu.ver: Add new exports.
+       * include/bits/basic_ios.h (basic_ios::operator bool): Define.
+       * src/c++98/ios_locale.cc (basic_ios::operator void*): Instantiate.
+
 2014-09-24  François Dumont  <fdumont@gcc.gnu.org>
 
        PR libstdc++/29988
index 63985fd8538827533cf589b4307cee50a4dffb7d..0559444a87b81d844cc6a09471fc9dce7b094042 100644 (file)
@@ -1470,6 +1470,9 @@ GLIBCXX_3.4.21 {
     _ZNSoC[12]ERSd;
     _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]ERSt14basic_iostreamIwS1_E;
 
+    # std::basic_ios::operator bool() const
+    _ZNKSt9basic_iosI[cw]St11char_traitsI[cw]EEcvbEv;
+
 } GLIBCXX_3.4.20;
 
 
index 10263ed07a42e79fc95e6b1eb4cc6a97be413b49..0a83d0d1f28d6d1327817ceccc36da995540afd8 100644 (file)
@@ -113,8 +113,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        *  This allows you to write constructs such as
        *  <code>if (!a_stream) ...</code> and <code>while (a_stream) ...</code>
       */
+#if __cplusplus >= 201103L
+      explicit operator bool() const
+      { return !this->fail(); }
+#else
       operator void*() const
       { return this->fail() ? 0 : const_cast<basic_ios*>(this); }
+#endif
 
       bool
       operator!() const
index fd2e9e430d8976ee4a32fa8ab0cc9acb5c4205d2..968af981f414562e16954b8f420d7f2adc2ce378 100644 (file)
@@ -54,5 +54,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     return __old;
   }
 
+  // Explicit instantiations for basic_ios are done in src/c++11/ios.cc
+  // and so do not include this member, which is only defined for C++98.
+  template basic_ios<char>::operator void*() const;
+#ifdef _GLIBCXX_USE_WCHAR_T
+  template basic_ios<wchar_t>::operator void*() const;
+#endif
+
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace