Make std::forward and std::move (and std::move_if_noexcept) constexpr in C++14

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186344 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2013-07-15 20:46:11 +00:00
parent 1e1d05121d
commit 01a0e90783
5 changed files with 22 additions and 9 deletions

View File

@@ -70,4 +70,11 @@ int main()
static_assert(sizeof(test(std::forward<const A>(ca))) == 2, "");
static_assert(sizeof(test(std::forward<const A>(csource()))) == 2, "");
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if _LIBCPP_STD_VER > 11
constexpr int i1 = std::move(23);
static_assert(i1 == 23, "" );
constexpr int i2 = std::forward<int>(42);
static_assert(i2 == 42, "" );
#endif
}

View File

@@ -60,4 +60,10 @@ int main()
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
#if _LIBCPP_STD_VER > 11
constexpr int i1 = 23;
constexpr int i2 = std::move_if_noexcept(i1);
static_assert(i2 == 23, "" );
#endif
}