[libsigcplusplus] Revert "tuple tests: Use static_assert() in constexpr tests."



commit 484cf930cfc26a13a4c470a9d98daeeb8c62a6d0
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Apr 1 17:59:49 2016 +0200

    Revert "tuple tests: Use static_assert() in constexpr tests."
    
    This reverts commit 798210eeaedd88477b71115423b1d7928e81138f.
    
    Because this doesn't work with g++ (at least version 5.2.1)
    though it does work with clang++ (3.8).
    
    g++ gives this error:
    
    test_tuple_start.cc: In function ‘constexpr void test_tuple_start_constexpr()’:
    test_tuple_start.cc:130:3: error: non-constant condition for static assertion
       static_assert(std::get<0>(t_prefix) == nullptr,
       ^
    test_tuple_start.cc:130:3: error: ‘nullptr’ is not a constant expression

 tests/test_tuple_cdr.cc   |    6 ++----
 tests/test_tuple_start.cc |    6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/tests/test_tuple_cdr.cc b/tests/test_tuple_cdr.cc
index 22ed032..e6355bf 100644
--- a/tests/test_tuple_cdr.cc
+++ b/tests/test_tuple_cdr.cc
@@ -75,10 +75,8 @@ test_tuple_cdr_constexpr()
 
   constexpr auto t_larger = std::make_tuple(nullptr, str_hello, str_world);
   constexpr auto t_suffix = sigc::internal::tuple_cdr(t_larger);
-  static_assert(std::get<0>(t_suffix) == str_hello,
-    "unexpected tuple element value.");
-  static_assert(std::get<1>(t_suffix) == str_world,
-    "unexpected tuple element value.");
+  assert(std::get<0>(t_suffix) == str_hello);
+  assert(std::get<1>(t_suffix) == str_world);
 }
 
 int
diff --git a/tests/test_tuple_start.cc b/tests/test_tuple_start.cc
index 08be22d..5c9e11b 100644
--- a/tests/test_tuple_start.cc
+++ b/tests/test_tuple_start.cc
@@ -127,10 +127,8 @@ test_tuple_start_constexpr()
   static_assert(
     std::tuple_size<decltype(t_prefix)>::value == 2, "unexpected tuple_start()ed tuple size.");
 
-  static_assert(std::get<0>(t_prefix) == nullptr,
-    "unexpected tuple element value.");
-  static_assert(std::get<1>(t_prefix) == str_hello,
-    "unexpected tuple element value.");
+  assert(std::get<0>(t_prefix) == nullptr);
+  assert(std::get<1>(t_prefix) == str_hello);
 }
 
 int


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]