[libcxx-commits] [libcxx] r364053 - Make rvalue metaprogramming traits work in C++03.

Eric Fiselier via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 21 07:31:35 PDT 2019


Author: ericwf
Date: Fri Jun 21 07:31:34 2019
New Revision: 364053

URL: http://llvm.org/viewvc/llvm-project?rev=364053&view=rev
Log:
Make rvalue metaprogramming traits work in C++03.

The next step is to get move and forward working in C++03.

Modified:
    libcxx/trunk/include/type_traits
    libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp
    libcxx/trunk/test/std/utilities/utility/declval/declval.pass.cpp

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Fri Jun 21 07:31:34 2019
@@ -808,15 +808,11 @@ template <class _Tp> struct _LIBCPP_TEMP
 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 = ty
 
 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_TEMP
 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_TEMP
 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>

Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_lvalue_ref.pass.cpp Fri Jun 21 07:31:34 2019
@@ -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;
 }

Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/add_rvalue_ref.pass.cpp Fri Jun 21 07:31:34 2019
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++98, c++03
-
 // type_traits
 
 // add_rvalue_reference

Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.ref/remove_ref.pass.cpp Fri Jun 21 07:31:34 2019
@@ -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;
 }

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_lvalue_reference.pass.cpp Fri Jun 21 07:31:34 2019
@@ -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"

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/is_rvalue_reference.pass.cpp Fri Jun 21 07:31:34 2019
@@ -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"

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.cat/rvalue_ref.pass.cpp Fri Jun 21 07:31:34 2019
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++98, c++03
-
 // type_traits
 
 // rvalue_ref

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/is_reference.pass.cpp Fri Jun 21 07:31:34 2019
@@ -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>();

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.comp/rvalue_ref.pass.cpp Fri Jun 21 07:31:34 2019
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// UNSUPPORTED: c++98, c++03
-
 // type_traits
 
 // rvalue_ref

Modified: libcxx/trunk/test/std/utilities/utility/declval/declval.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/declval/declval.pass.cpp?rev=364053&r1=364052&r2=364053&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/declval/declval.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/declval/declval.pass.cpp Fri Jun 21 07:31:34 2019
@@ -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;
 }




More information about the libcxx-commits mailing list