From 46bd7f739f03b608b2d49b914608a76c24ab1f42 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 15 Apr 2015 13:39:59 +1000 Subject: [PATCH] tap: explicitly type the test as std::function clang doesn't like to implicitly cast lambdas to functions. --- tap.ipp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tap.ipp b/tap.ipp index 42e797f6..570b2513 100644 --- a/tap.ipp +++ b/tap.ipp @@ -39,7 +39,7 @@ template void util::TAP::logger::expect_eq (const T&a, const U &b, const std::string &msg) { - static const auto TEST = [] (const T &t, const U &u) -> bool { + static const std::function TEST = [] (const T &t, const U &u) -> bool { return almost_equal (t, u); }; @@ -52,7 +52,7 @@ template void util::TAP::logger::expect_neq (const T&a, const U &b, const std::string &msg) { - static const auto TEST = [] (const T &t, const U &u) -> bool { + static const std::function TEST = [] (const T &t, const U &u) -> bool { return !almost_equal (t, u); }; @@ -68,7 +68,8 @@ util::TAP::logger::expect_ ## SUFFIX (const T &a, \ const U &b, \ const std::string &msg) \ { \ - expect ([] (const T&t, const U&u) { return t OP u; }, a, b, msg); \ + static const std::function TEST = [] (const T&t, const U&u) { return t OP u; }; \ + expect (TEST, a, b, msg); \ } TAP_TEST(gt, > ) @@ -85,5 +86,5 @@ void util::TAP::logger::expect_nan (const T &t, const std::string &msg) { bool(*func)(T) = std::isnan; - expect (func, t, msg); + expect (std::function (func), t, msg); }