From 21dc552cf96ba37a704e313f91fdcf27b3901a32 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 2 Sep 2016 19:14:00 +0300 Subject: [PATCH] Added a workaround for gcc 4.6 in C++11 mode as it can't seem to handle defaulted functions with noexcept specifier. The problem was discovered with autotests. --- include/boost/utility/string_ref.hpp | 9 +++++++-- include/boost/utility/string_view.hpp | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/boost/utility/string_ref.hpp b/include/boost/utility/string_ref.hpp index 447d3cc..5acf346 100644 --- a/include/boost/utility/string_ref.hpp +++ b/include/boost/utility/string_ref.hpp @@ -27,6 +27,11 @@ #include #include +#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (defined(BOOST_GCC) && ((BOOST_GCC+0) / 100) <= 406) +// GCC 4.6 cannot handle a defaulted function with noexcept specifier +#define BOOST_STRING_REF_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS +#endif + namespace boost { namespace detail { @@ -63,14 +68,14 @@ namespace boost { // by defaulting these functions, basic_string_ref becomes // trivially copy/move constructible. BOOST_CONSTEXPR basic_string_ref (const basic_string_ref &rhs) BOOST_NOEXCEPT -#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#ifndef BOOST_STRING_REF_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS = default; #else : ptr_(rhs.ptr_), len_(rhs.len_) {} #endif basic_string_ref& operator=(const basic_string_ref &rhs) BOOST_NOEXCEPT -#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#ifndef BOOST_STRING_REF_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS = default; #else { diff --git a/include/boost/utility/string_view.hpp b/include/boost/utility/string_view.hpp index aae7f25..f5d5eb9 100644 --- a/include/boost/utility/string_view.hpp +++ b/include/boost/utility/string_view.hpp @@ -30,6 +30,11 @@ #include #include +#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (defined(BOOST_GCC) && ((BOOST_GCC+0) / 100) <= 406) +// GCC 4.6 cannot handle a defaulted function with noexcept specifier +#define BOOST_STRING_VIEW_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS +#endif + namespace boost { namespace detail { @@ -68,14 +73,14 @@ namespace boost { // by defaulting these functions, basic_string_ref becomes // trivially copy/move constructible. BOOST_CONSTEXPR basic_string_view(const basic_string_view &rhs) BOOST_NOEXCEPT -#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#ifndef BOOST_STRING_VIEW_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS = default; #else : ptr_(rhs.ptr_), len_(rhs.len_) {} #endif basic_string_view& operator=(const basic_string_view &rhs) BOOST_NOEXCEPT -#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#ifndef BOOST_STRING_VIEW_NO_CXX11_DEFAULTED_NOEXCEPT_FUNCTIONS = default; #else {