From eae7c21177b6cebe1adc05f12e1e57b4c68fc4d4 Mon Sep 17 00:00:00 2001 From: Nicholas Guarracino Date: Thu, 12 Nov 2015 16:23:37 -0500 Subject: [PATCH] Add workarounds for g++ 4.9 --- include/gsl.h | 4 ++++ include/span.h | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/include/gsl.h b/include/gsl.h index e20ac69..6eb29ce 100644 --- a/include/gsl.h +++ b/include/gsl.h @@ -45,6 +45,10 @@ #endif // _MSC_VER +#if (__GNUC__ < 5) && !defined(__clang__) +#define constexpr /* nothing */ +#endif + // In order to test the library, we need it to throw exceptions that we can catch #ifdef GSL_THROWS_FOR_TESTING #define noexcept /* nothing */ diff --git a/include/span.h b/include/span.h index 74da1aa..d094496 100644 --- a/include/span.h +++ b/include/span.h @@ -60,6 +60,10 @@ #endif // _MSC_VER +#if (__GNUC__ < 5) && !defined(__clang__) +#define constexpr /* nothing */ +#endif + // In order to test the library, we need it to throw exceptions that we can catch #ifdef GSL_THROWS_FOR_TESTING #define noexcept /* nothing */ @@ -227,6 +231,9 @@ private: #ifndef _MSC_VER +#if (__GNUC__ < 5) && !defined(__clang__) +const std::ptrdiff_t dynamic_range = -1; +#else struct static_bounds_dynamic_range_t { template ::value>> @@ -262,6 +269,8 @@ constexpr bool operator !=(T left, static_bounds_dynamic_range_t right) noexcept } constexpr static_bounds_dynamic_range_t dynamic_range{}; +#endif + #else const std::ptrdiff_t dynamic_range = -1; #endif