Skip to content

Commit 80a37e0

Browse files
authored
Merge pull request #3495 from pherl/c++11
Add std::forward and std::move autoconf check
2 parents 3d2f72b + 4a4c67b commit 80a37e0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

m4/ax_cxx_compile_stdcxx.m4

+19
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
180180
181181
#else
182182
183+
#include <utility>
184+
183185
namespace cxx11
184186
{
185187
@@ -445,6 +447,23 @@ namespace cxx11
445447
446448
}
447449
450+
namespace test_std_move_and_forward
451+
{
452+
struct message {};
453+
char foo(message&) { return '\0'; }
454+
int foo(message&&) { return 0; }
455+
456+
template<typename Arg, typename RT>
457+
void check(Arg&& arg, RT rt) {
458+
static_assert(sizeof(rt) == sizeof(foo(std::forward<Arg>(arg))), "");
459+
}
460+
void test() {
461+
message a;
462+
check(a, char());
463+
check(std::move(a), int());
464+
}
465+
}
466+
448467
} // namespace cxx11
449468
450469
#endif // __cplusplus >= 201103L

0 commit comments

Comments
 (0)