From 14b554c462d5b6450fa24afb7ba55435ebd4b46f Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Fri, 12 Feb 2021 11:36:27 +0000 Subject: [PATCH] libstdc++: Fix errors when syncbuf is used without RTTI 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream index 85ed47ecbce..c7c4e78e8a7 100644 --- a/libstdc++-v3/include/std/ostream +++ b/libstdc++-v3/include/std/ostream @@ -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; } -- 2.30.2