diff options
| author | Eric Fiselier <eric@efcs.ca> | 2019-06-21 14:31:34 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2019-06-21 14:31:34 +0000 |
| commit | 87cf92d9cb9379f7d3f1a601fc17d56bb2d18d80 (patch) | |
| tree | 8a97a03cd630b433be99dd7a407166c6616279cc /libcxx | |
| parent | fa1c7d9bdf64ff4ae2348a127e984de1aeb23740 (diff) | |
| download | bcm5719-llvm-87cf92d9cb9379f7d3f1a601fc17d56bb2d18d80.tar.gz bcm5719-llvm-87cf92d9cb9379f7d3f1a601fc17d56bb2d18d80.zip | |
Make rvalue metaprogramming traits work in C++03.
The next step is to get move and forward working in C++03.
llvm-svn: 364053
Diffstat (limited to 'libcxx')
10 files changed, 0 insertions, 43 deletions
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index f0c7fdebb8c..c02a208f4ed 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -808,15 +808,11 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : pub template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {}; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {}; -#endif template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; -#endif #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) template <class _Tp> @@ -1130,9 +1126,7 @@ template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG_TYPE _Tp type;}; -#endif #if _LIBCPP_STD_VER > 11 template <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; @@ -1150,8 +1144,6 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_lvalue_reference template <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; #endif -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template <class _Tp, bool = __is_referenceable<_Tp>::value> struct __add_rvalue_reference_impl { typedef _LIBCPP_NODEBUG_TYPE _Tp type; }; template <class _Tp > struct __add_rvalue_reference_impl<_Tp, true> { typedef _LIBCPP_NODEBUG_TYPE _Tp&& type; }; @@ -1162,10 +1154,6 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_rvalue_reference template <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; #endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - template <class _Tp> _Tp&& __declval(int); template <class _Tp> _Tp __declval(long); @@ -1173,14 +1161,6 @@ template <class _Tp> decltype(_VSTD::__declval<_Tp>(0)) declval() _NOEXCEPT; -#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -template <class _Tp> -typename add_lvalue_reference<_Tp>::type -declval(); - -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - // __uncvref template <class _Tp> diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp index b40e68ab4e3..3abc949335e 100644 --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp @@ -58,23 +58,19 @@ int main(int, char**) // LWG 2101 specifically talks about add_lvalue_reference and functions. // The term of art is "a referenceable type", which a cv- or ref-qualified function is not. test_function0<void()>(); -#if TEST_STD_VER >= 11 test_function1<void() const>(); test_function1<void() &>(); test_function1<void() &&>(); test_function1<void() const &>(); test_function1<void() const &&>(); -#endif // But a cv- or ref-qualified member function *is* "a referenceable type" test_function0<void (Foo::*)()>(); -#if TEST_STD_VER >= 11 test_function0<void (Foo::*)() const>(); test_function0<void (Foo::*)() &>(); test_function0<void (Foo::*)() &&>(); test_function0<void (Foo::*)() const &>(); test_function0<void (Foo::*)() const &&>(); -#endif return 0; } diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp index 22628a3a2cf..d67db440fa2 100644 --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // type_traits // add_rvalue_reference diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp index 50927fadb83..2b11e0b7332 100644 --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp @@ -36,13 +36,11 @@ int main(int, char**) test_remove_reference<int*&, int*>(); test_remove_reference<const int*&, const int*>(); -#if TEST_STD_VER >= 11 test_remove_reference<int&&, int>(); test_remove_reference<const int&&, const int>(); test_remove_reference<int(&&)[3], int[3]>(); test_remove_reference<int*&&, int*>(); test_remove_reference<const int*&&, const int*>(); -#endif return 0; } diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp index ed32cd9b999..9235efbb1dd 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp @@ -10,8 +10,6 @@ // is_lvalue_reference -// UNSUPPORTED: c++98, c++03 - #include <type_traits> #include <cstddef> // for std::nullptr_t #include "test_macros.h" diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp index d17ed5feeff..b424c7e038c 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp @@ -10,8 +10,6 @@ // is_rvalue_reference -// UNSUPPORTED: c++98, c++03 - #include <type_traits> #include <cstddef> // for std::nullptr_t #include "test_macros.h" diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp index e40a2a01443..b2537790cb7 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // type_traits // rvalue_ref diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp index bb8a2d62ca9..e6fd1e67aed 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp @@ -75,10 +75,7 @@ typedef void (*FunctionPtr)(); int main(int, char**) { test_is_reference<int&>(); -#if TEST_STD_VER >= 11 test_is_reference<int&&>(); -#endif - test_is_not_reference<std::nullptr_t>(); test_is_not_reference<void>(); test_is_not_reference<int>(); diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp index f00307aa969..13b35d3a779 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 - // type_traits // rvalue_ref diff --git a/libcxx/test/std/utilities/utility/declval/declval.pass.cpp b/libcxx/test/std/utilities/utility/declval/declval.pass.cpp index 6509fd4377c..f56a6fd779e 100644 --- a/libcxx/test/std/utilities/utility/declval/declval.pass.cpp +++ b/libcxx/test/std/utilities/utility/declval/declval.pass.cpp @@ -23,11 +23,7 @@ class A int main(int, char**) { -#if TEST_STD_VER >= 11 static_assert((std::is_same<decltype(std::declval<A>()), A&&>::value), ""); -#else - static_assert((std::is_same<decltype(std::declval<A>()), A&>::value), ""); -#endif return 0; } |

