Permalink
Browse files

Add a feature test for full expression sfinae support

* Tests whether the compiler provides full expression SFINAE
  supports so all parts of HPX can be compiled.
* Currently MSVC is the only compiler that doesn't implement it.
  • Loading branch information...
Naios committed Jun 24, 2017
1 parent 4788bdb commit 7108fff97d167ac1c123ffc87de62cd0e85a9a3a
Showing with 53 additions and 0 deletions.
  1. +7 −0 cmake/HPX_AddConfigTest.cmake
  2. +46 −0 cmake/tests/cxx11_sfinae_expression_complete.cpp
@@ -234,6 +234,13 @@ macro(hpx_check_for_cxx11_sfinae_expression)
FILE ${ARGN})
endmacro()
###############################################################################
macro(hpx_check_for_cxx11_sfinae_expression_complete)
add_hpx_in_framework_config_test(HPX_HAVE_CXX11_SFINAE_EXPRESSION_COMPLETE
SOURCE cmake/tests/cxx11_sfinae_expression_complete.cpp
FILE ${ARGN})
endmacro()
###############################################################################
macro(hpx_check_for_cxx11_defaulted_functions)
add_hpx_config_test(HPX_WITH_CXX11_DEFAULTED_FUNCTIONS
@@ -0,0 +1,46 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 Denis Blank
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////
#include <hpx/util/pack_traversal.hpp>
#include <type_traits>
#include <utility>
#include <vector>
struct all_map_float
{
template <typename T>
float operator()(T el) const
{
return float(el + 1.f);
}
};
int main(int, char**)
{
auto res = hpx::util::map_pack(all_map_float{},
0,
1.f,
hpx::util::make_tuple(1.f, 3),
std::vector<std::vector<int>>{{1, 2}, {4, 5}},
std::vector<std::vector<float>>{{1.f, 2.f}, {4.f, 5.f}},
2);
auto expected = hpx::util::make_tuple( // ...
1.f,
2.f,
hpx::util::make_tuple(2.f, 4.f),
std::vector<std::vector<float>>{{2.f, 3.f}, {5.f, 6.f}},
std::vector<std::vector<float>>{{2.f, 3.f}, {5.f, 6.f}},
3.f);
static_assert(std::is_same<decltype(res), decltype(expected)>::value,
"Type mismatch!");
(void) res;
(void) expected;
}

0 comments on commit 7108fff

Please sign in to comment.