libstdc++: Fix errors when syncbuf is used without RTTI
authorJonathan Wakely <jwakely@redhat.com>
Fri, 12 Feb 2021 11:36:27 +0000 (11:36 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 12 Feb 2021 14:30:12 +0000 (14:30 +0000)
libstdc++-v3/ChangeLog:

* include/std/ostream (__syncbuf_base::_S_get): Mark parameter
as unused and only use dynamic_cast when RTTI is enabled.

libstdc++-v3/include/std/ostream

index 85ed47ecbce432406b7e151caaf461ab0a0bf248..c7c4e78e8a71dd961bb96f89b3514c015f14a29c 100644 (file)
@@ -783,10 +783,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
     public:
       static bool*
-      _S_get(basic_streambuf<_CharT, _Traits>* __buf) noexcept
+      _S_get(basic_streambuf<_CharT, _Traits>* __buf [[maybe_unused]]) noexcept
       {
+#if __cpp_rtti
        if (auto __p = dynamic_cast<__syncbuf_base*>(__buf))
          return &__p->_M_emit_on_sync;
+#endif
        return nullptr;
       }