From 9205efda02a788084a332bff06733572a338b132 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 6 Sep 2016 08:53:55 -0400 Subject: [PATCH] Add constexpr to CRYPTOPP_CONSTANT when CRYPTOPP_CXX11_CONSTEXPR is in effect --- config.h | 6 ++++++ config.recommend | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/config.h b/config.h index a25d1430..ab00dc7a 100644 --- a/config.h +++ b/config.h @@ -902,6 +902,12 @@ NAMESPACE_END # define CRYPTOPP_ALIGN_DATA(x) alignas(x) #endif // CRYPTOPP_CXX11_ALIGNAS +// Hack... CRYPTOPP_CONSTANT is defined earlier, before C++11 constexpr availability is determined +#if defined(CRYPTOPP_CXX11_CONSTEXPR) +# undef CRYPTOPP_CONSTANT +# define CRYPTOPP_CONSTANT(x) constexpr static int x; +#endif + // OK to comment the following out, but please report it so we can fix it. // C++17 value taken from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf. #if (defined(__cplusplus) && (__cplusplus >= 199711L) && (__cplusplus < 201402L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE) diff --git a/config.recommend b/config.recommend index c9a1c9db..61fcb1df 100644 --- a/config.recommend +++ b/config.recommend @@ -902,6 +902,12 @@ NAMESPACE_END # define CRYPTOPP_ALIGN_DATA(x) alignas(x) #endif // CRYPTOPP_CXX11_ALIGNAS +// Hack... CRYPTOPP_CONSTANT is defined earlier, before C++11 constexpr availability is determined +#if defined(CRYPTOPP_CXX11_CONSTEXPR) +# undef CRYPTOPP_CONSTANT +# define CRYPTOPP_CONSTANT(x) constexpr static int x; +#endif + // OK to comment the following out, but please report it so we can fix it. // C++17 value taken from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf. #if (defined(__cplusplus) && (__cplusplus >= 199711L) && (__cplusplus < 201402L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE)