diff options
author | Jisi Liu <liujisi@google.com> | 2017-08-15 16:39:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-15 16:39:12 -0700 |
commit | 80a37e0782d2d702d52234b62dd4b9ec74fd2c95 (patch) | |
tree | 043308f6049940ffbbb516b2c21bad25afe7f9ab /m4/ax_cxx_compile_stdcxx.m4 | |
parent | 3d2f72bf01782ee83c8a2cde082bddb47931443b (diff) | |
parent | 4a4c67b6a2aa7d2c5051a53c25a96008956b587f (diff) | |
download | protobuf-80a37e0782d2d702d52234b62dd4b9ec74fd2c95.tar.gz protobuf-80a37e0782d2d702d52234b62dd4b9ec74fd2c95.tar.bz2 protobuf-80a37e0782d2d702d52234b62dd4b9ec74fd2c95.zip |
Merge pull request #3495 from pherl/c++11v3.4.0
Add std::forward and std::move autoconf check
Diffstat (limited to 'm4/ax_cxx_compile_stdcxx.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 |