Skip to content

Commit

Permalink
Merge pull request #3495 from pherl/c++11
Browse files Browse the repository at this point in the history
Add std::forward and std::move autoconf check
  • Loading branch information
liujisi authored Aug 15, 2017
2 parents 3d2f72b + 4a4c67b commit 80a37e0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions m4/ax_cxx_compile_stdcxx.m4
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
#else
#include <utility>
namespace cxx11
{
Expand Down Expand Up @@ -445,6 +447,23 @@ namespace cxx11
}
namespace test_std_move_and_forward
{
struct message {};
char foo(message&) { return '\0'; }
int foo(message&&) { return 0; }
template<typename Arg, typename RT>
void check(Arg&& arg, RT rt) {
static_assert(sizeof(rt) == sizeof(foo(std::forward<Arg>(arg))), "");
}
void test() {
message a;
check(a, char());
check(std::move(a), int());
}
}
} // namespace cxx11
#endif // __cplusplus >= 201103L
Expand Down

0 comments on commit 80a37e0

Please sign in to comment.