From 379200dfd15c4f239870cb81d4ebe31a981a540f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 8 Sep 2017 18:12:02 +0300 Subject: [PATCH] Force result_of use decltype whenever possible to maximize testing of function input iterator with lambdas. --- test/function_input_iterator_test.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/function_input_iterator_test.cpp b/test/function_input_iterator_test.cpp index 5443a11..6be27d2 100644 --- a/test/function_input_iterator_test.cpp +++ b/test/function_input_iterator_test.cpp @@ -10,6 +10,16 @@ #include #include + +#if !defined(BOOST_NO_CXX11_DECLTYPE) +// Force boost::result_of use decltype, even on compilers that don't support N3276. +// This enables this test to also verify if the iterator works with lambdas +// on such compilers with this config macro. Note that without the macro result_of +// (and consequently the iterator) is guaranteed to _not_ work, so this case is not +// worth testing anyway. +#define BOOST_RESULT_OF_USE_DECLTYPE +#endif + #include #include @@ -90,7 +100,7 @@ int main() BOOST_TEST_EQ(generated[i], static_cast(42 + i)); #if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ - && (!defined(BOOST_NO_CXX11_DECLTYPE_N3276) || defined(BOOST_RESULT_OF_USE_DECLTYPE)) + && defined(BOOST_RESULT_OF_USE_DECLTYPE) // test the iterator with lambda expressions int num = 42; auto lambda_generator = [&num] { return num++; };