From 1115d52ab74c1341c079832f55d6c88c280f9e08 Mon Sep 17 00:00:00 2001 From: Sven Scharmentke Date: Tue, 16 Jul 2019 09:12:43 +0200 Subject: [PATCH] Attempt to fix compile issues on old C++ standard. --- test/cxxtest/general.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/cxxtest/general.h b/test/cxxtest/general.h index abb39f0..586b6f2 100644 --- a/test/cxxtest/general.h +++ b/test/cxxtest/general.h @@ -2,7 +2,6 @@ #include #include #include -#include #define static_assert_1(e) static_assert(e, #e) @@ -17,7 +16,6 @@ BETTER_ENUM(Channel, short, Red, Green, Blue) BETTER_ENUM(Depth, short, HighColor = 40, TrueColor = 20) BETTER_ENUM(Compression, short, None, Huffman, Default = Huffman) -BETTER_ENUMS_DECLARE_STD_HASH(Channel) namespace test { @@ -26,13 +24,14 @@ BETTER_ENUM(Namespaced, short, One, Two) } - - // Using BETTER_ENUMS_HAVE_CONSTEXPR_ as a proxy for C++11 support. This should // be changed to be more precise in the future. #ifdef BETTER_ENUMS_HAVE_CONSTEXPR_ +BETTER_ENUMS_DECLARE_STD_HASH(Channel) + #include +#include // Type properties. static_assert_1(std::is_class()); @@ -164,9 +163,11 @@ class HashTests : public CxxTest::TestSuite { public: void test_same_values() { +#ifdef _ENUM_HAVE_CONSTEXPR TS_ASSERT_EQUALS(std::hash().operator()(Channel::Red), std::hash().operator()(0)); TS_ASSERT_EQUALS(std::hash().operator()(Channel::Green), std::hash().operator()(1)); TS_ASSERT_EQUALS(std::hash().operator()(Channel::Blue), std::hash().operator()(2)); +#endif // #ifdef _ENUM_HAVE_CONSTEXPR } };