Skip to content

Commit 4a4c67b

Browse files
committed
Add std::forward and std::move autoconf check
Protobuf now uses these two features, which are not available on some platforms.
1 parent eaeca0d commit 4a4c67b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

m4/ax_cxx_compile_stdcxx.m4

Lines changed: 19 additions & 0 deletions
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)