From 614d23129684f96ff0c5d77ee9c5a29be1f44272 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 2 Aug 2016 15:45:37 +0200 Subject: Reimplement throw_ios_failure() to keep Clang 3.5 happy --- butl/fdstream.cxx | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'butl') diff --git a/butl/fdstream.cxx b/butl/fdstream.cxx index e2095ba..f761e7b 100644 --- a/butl/fdstream.cxx +++ b/butl/fdstream.cxx @@ -34,30 +34,26 @@ namespace butl { // throw_ios_failure // - template ::value> - struct throw_ios + template + static inline void + throw_ios_failure (error_code e, typename enable_if::type m) { - static void impl (error_code e, const char* m) { - throw ios_base::failure (m, e);} - }; - - template <> - struct throw_ios - { - static void impl (error_code, const char* m) {throw ios_base::failure (m);} - }; + throw ios_base::failure (m, e); + } - inline void - throw_ios_failure (int ev) + template + static inline void + throw_ios_failure (error_code, typename enable_if::type m) { - error_code ec (ev, system_category ()); - throw_ios<>::impl (ec, ec.message ().c_str ()); + throw ios_base::failure (m); } inline void - throw_ios_failure (int ev, const char* m) + throw_ios_failure (int ev, const char* m = nullptr) { - throw_ios<>::impl (error_code (ev, system_category ()), m); + error_code ec (ev, system_category ()); + throw_ios_failure::value> ( + ec, m != nullptr ? m : ec.message ().c_str ()); } // fdbuf -- cgit v1.1