diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-08-15 11:44:16 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-08-15 11:44:16 -0700 |
commit | 4a4c67b6a2aa7d2c5051a53c25a96008956b587f (patch) | |
tree | 1ea95e3e8aa159d1e1de815d6be8070b5b138d17 /m4 | |
parent | eaeca0d42b1fc4a8023a7f90d889631eda9360a3 (diff) | |
download | protobuf-4a4c67b6a2aa7d2c5051a53c25a96008956b587f.tar.gz protobuf-4a4c67b6a2aa7d2c5051a53c25a96008956b587f.tar.bz2 protobuf-4a4c67b6a2aa7d2c5051a53c25a96008956b587f.zip |
Add std::forward and std::move autoconf check
Protobuf now uses these two features, which are not available on some
platforms.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ax_cxx_compile_stdcxx.m4 | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 index b61fcb63..d3288e2f 100644 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -180,6 +180,8 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ #else +#include <utility> + namespace cxx11 { @@ -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 |