Hello,

ran into the following when building libstdc++ without rtti support:

libstdc++-v3/src/c++11/cxx11-ios_failure.cc:174:54: error: no matching function for call to 'std::ios_base::failure::failure(const char*&, int&)'

Attached patch does as follows:

ifdef rtti specific function __throw_ios_failure() by __cpp_rtti


Overloaded __throw_ios_failure(const char*, int) got introduced in

484e936e88e5, however __ios_failure() with respective signature is only

defined if __cpp_rtti is defined, hence should only be used within

contexts also guarded by __cpp_rtti.



This was done correctly for the c++98 part and probably just forgotten

for c++11.

Thanks

  mirko

PS: Shouldn't this have been covered by any tests?
>From 46aa7ca34b832695b3f13167034f6aa19f44d074 Mon Sep 17 00:00:00 2001
From: Mirko Vogt <mirko.v...@sensorberg.com>
Date: Thu, 11 Feb 2021 23:18:28 +0000
Subject: [PATCH] ifdef rtti specific function __throw_ios_failure() by
 __cpp_rtti

Overloaded __throw_ios_failure(const char*, int) got introduced in
484e936e88e5, however __ios_failure() with respective signature is only
defined if __cpp_rtti is defined, hence should only be used within
contexts also guarded by __cpp_rtti.

This was done correctly for the c++98 part and probably just forgotten
for c++11.
---
 libstdc++-v3/src/c++11/cxx11-ios_failure.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
index e82c1aaf63b..7edde29f0e8 100644
--- a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
+++ b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc
@@ -168,10 +168,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   __throw_ios_failure(const char* __s __attribute__((unused)))
   { _GLIBCXX_THROW_OR_ABORT(__ios_failure(_(__s))); }
 
+#if __cpp_rtti
   void
   __throw_ios_failure(const char* str __attribute__((unused)),
 		      int err __attribute__((unused)))
   { _GLIBCXX_THROW_OR_ABORT(__ios_failure(_(str), err)); }
+#endif
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
-- 
2.20.1

Reply via email to