forked from OSchip/llvm-project
Remove __uncvref; use __uncvref_t instead
Reviewed By: Quuxplusone, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D119958
This commit is contained in:
parent
86e26f09a4
commit
f755806813
|
@ -25,9 +25,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
template<class _Tp>
|
||||
struct is_bind_expression : _If<
|
||||
_IsSame<_Tp, typename __uncvref<_Tp>::type>::value,
|
||||
_IsSame<_Tp, __uncvref_t<_Tp> >::value,
|
||||
false_type,
|
||||
is_bind_expression<typename __uncvref<_Tp>::type>
|
||||
is_bind_expression<__uncvref_t<_Tp> >
|
||||
> {};
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
@ -37,9 +37,9 @@ inline constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value;
|
|||
|
||||
template<class _Tp>
|
||||
struct is_placeholder : _If<
|
||||
_IsSame<_Tp, typename __uncvref<_Tp>::type>::value,
|
||||
_IsSame<_Tp, __uncvref_t<_Tp> >::value,
|
||||
integral_constant<int, 0>,
|
||||
is_placeholder<typename __uncvref<_Tp>::type>
|
||||
is_placeholder<__uncvref_t<_Tp> >
|
||||
> {};
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
|
|
@ -47,7 +47,7 @@ template <class ..._Args>
|
|||
struct __is_hash_value_type : false_type {};
|
||||
|
||||
template <class _One>
|
||||
struct __is_hash_value_type<_One> : __is_hash_value_type_imp<typename __uncvref<_One>::type> {};
|
||||
struct __is_hash_value_type<_One> : __is_hash_value_type_imp<__uncvref_t<_One> > {};
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
size_t __next_prime(size_t __n);
|
||||
|
|
|
@ -36,7 +36,7 @@ extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg;
|
|||
template <class _Tp, class _Alloc, class ..._Args>
|
||||
struct __uses_alloc_ctor_imp
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG typename __uncvref<_Alloc>::type _RawAlloc;
|
||||
typedef _LIBCPP_NODEBUG __uncvref_t<_Alloc> _RawAlloc;
|
||||
static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value;
|
||||
static const bool __ic =
|
||||
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
|
||||
|
|
|
@ -545,7 +545,7 @@ template <class ..._Args>
|
|||
struct __is_tree_value_type : false_type {};
|
||||
|
||||
template <class _One>
|
||||
struct __is_tree_value_type<_One> : __is_tree_value_type_imp<typename __uncvref<_One>::type> {};
|
||||
struct __is_tree_value_type<_One> : __is_tree_value_type_imp<__uncvref_t<_One> > {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __tree_key_value_types {
|
||||
|
|
|
@ -278,7 +278,7 @@ using __type_pack_element _LIBCPP_NODEBUG = typename decltype(
|
|||
#endif
|
||||
|
||||
template <size_t _Ip, class ..._Types>
|
||||
struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>>
|
||||
struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...> >
|
||||
{
|
||||
static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range");
|
||||
typedef _LIBCPP_NODEBUG __type_pack_element<_Ip, _Types...> type;
|
||||
|
@ -469,8 +469,7 @@ template <class _SizeTrait, size_t _Expected>
|
|||
struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected>
|
||||
: integral_constant<bool, _SizeTrait::value == _Expected> {};
|
||||
|
||||
template <class _Tuple, size_t _ExpectedSize,
|
||||
class _RawTuple = typename __uncvref<_Tuple>::type>
|
||||
template <class _Tuple, size_t _ExpectedSize, class _RawTuple = __uncvref_t<_Tuple> >
|
||||
using __tuple_like_with_size _LIBCPP_NODEBUG = __tuple_like_with_size_imp<
|
||||
__tuple_like<_RawTuple>::value,
|
||||
tuple_size<_RawTuple>, _ExpectedSize
|
||||
|
|
|
@ -208,11 +208,9 @@ public:
|
|||
pair<_RandomAccessIterator2, _RandomAccessIterator2>
|
||||
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
||||
{
|
||||
static_assert ( std::is_same<
|
||||
typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
||||
typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
||||
>::value,
|
||||
"Corpus and Pattern iterators must point to the same type" );
|
||||
static_assert(__is_same_uncvref<typename iterator_traits<_RandomAccessIterator1>::value_type,
|
||||
typename iterator_traits<_RandomAccessIterator2>::value_type>::value,
|
||||
"Corpus and Pattern iterators must point to the same type");
|
||||
|
||||
if (__f == __l ) return make_pair(__l, __l); // empty corpus
|
||||
if (__first_ == __last_) return make_pair(__f, __f); // empty pattern
|
||||
|
@ -360,11 +358,9 @@ public:
|
|||
pair<_RandomAccessIterator2, _RandomAccessIterator2>
|
||||
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
|
||||
{
|
||||
static_assert ( std::is_same<
|
||||
typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
|
||||
typename std::__uncvref<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
|
||||
>::value,
|
||||
"Corpus and Pattern iterators must point to the same type" );
|
||||
static_assert(__is_same_uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type,
|
||||
typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value,
|
||||
"Corpus and Pattern iterators must point to the same type");
|
||||
|
||||
if (__f == __l ) return make_pair(__l, __l); // empty corpus
|
||||
if (__first_ == __last_) return make_pair(__f, __f); // empty pattern
|
||||
|
|
|
@ -1885,25 +1885,11 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
packaged_task() _NOEXCEPT : __p_(nullptr) {}
|
||||
template <class _Fp,
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<
|
||||
typename __uncvref<_Fp>::type,
|
||||
packaged_task
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
class = __enable_if_t<!is_same<__uncvref_t<_Fp>, packaged_task>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
|
||||
template <class _Fp, class _Allocator,
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<
|
||||
typename __uncvref<_Fp>::type,
|
||||
packaged_task
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
class = __enable_if_t<!is_same<__uncvref_t<_Fp>, packaged_task>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
|
||||
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
|
||||
|
@ -2014,25 +2000,11 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
packaged_task() _NOEXCEPT : __p_(nullptr) {}
|
||||
template <class _Fp,
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<
|
||||
typename __uncvref<_Fp>::type,
|
||||
packaged_task
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
class = __enable_if_t<!is_same<__uncvref_t<_Fp>, packaged_task>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
|
||||
template <class _Fp, class _Allocator,
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<
|
||||
typename __uncvref<_Fp>::type,
|
||||
packaged_task
|
||||
>::value
|
||||
>::type
|
||||
>
|
||||
class = __enable_if_t<!is_same<__uncvref_t<_Fp>, packaged_task>::value> >
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
|
||||
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
|
||||
|
|
|
@ -228,11 +228,7 @@ public:
|
|||
thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Fp, class ..._Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<typename __uncvref<_Fp>::type, thread>::value
|
||||
>::type
|
||||
>
|
||||
class = __enable_if_t<!is_same<__uncvref_t<_Fp>, thread>::value> >
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
explicit thread(_Fp&& __f, _Args&&... __args);
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
|
|
@ -1455,9 +1455,10 @@ struct __tuple_cat_return_1
|
|||
template <class ..._Types, class _Tuple0>
|
||||
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG typename __tuple_cat_type<tuple<_Types...>,
|
||||
typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type>::type
|
||||
type;
|
||||
using type _LIBCPP_NODEBUG = typename __tuple_cat_type<
|
||||
tuple<_Types...>,
|
||||
typename __make_tuple_types<__uncvref_t<_Tuple0> >::type
|
||||
>::type;
|
||||
};
|
||||
|
||||
template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
|
||||
|
@ -1465,7 +1466,7 @@ struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...
|
|||
: public __tuple_cat_return_1<
|
||||
typename __tuple_cat_type<
|
||||
tuple<_Types...>,
|
||||
typename __make_tuple_types<typename __uncvref<_Tuple0>::type>::type
|
||||
typename __make_tuple_types<__uncvref_t<_Tuple0> >::type
|
||||
>::type,
|
||||
__tuple_like<typename remove_reference<_Tuple1>::type>::value,
|
||||
_Tuple1, _Tuples...>
|
||||
|
|
|
@ -1274,33 +1274,25 @@ template <class _Tp>
|
|||
decltype(__declval<_Tp>(0))
|
||||
declval() _NOEXCEPT;
|
||||
|
||||
// __uncvref
|
||||
|
||||
template <class _Tp>
|
||||
struct __uncvref {
|
||||
typedef _LIBCPP_NODEBUG typename remove_cv<typename remove_reference<_Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __unconstref {
|
||||
typedef _LIBCPP_NODEBUG typename remove_const<typename remove_reference<_Tp>::type>::type type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
using __uncvref_t _LIBCPP_NODEBUG = typename __uncvref<_Tp>::type;
|
||||
#endif
|
||||
using __uncvref_t _LIBCPP_NODEBUG = typename remove_cv<typename remove_reference<_Tp>::type>::type;
|
||||
|
||||
// __is_same_uncvref
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __is_same_uncvref : _IsSame<typename __uncvref<_Tp>::type,
|
||||
typename __uncvref<_Up>::type> {};
|
||||
struct __is_same_uncvref : _IsSame<__uncvref_t<_Tp>, __uncvref_t<_Up> > {};
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
// remove_cvref - same as __uncvref
|
||||
template <class _Tp>
|
||||
struct remove_cvref : public __uncvref<_Tp> {};
|
||||
struct remove_cvref {
|
||||
using type _LIBCPP_NODEBUG = __uncvref_t<_Tp>;
|
||||
};
|
||||
|
||||
template <class _Tp> using remove_cvref_t = typename remove_cvref<_Tp>::type;
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <future>
|
||||
|
||||
// class packaged_task<R(ArgTypes...)>
|
||||
// template <class F, class Allocator>
|
||||
// packaged_task(allocator_arg_t, const Allocator& a, F&& f);
|
||||
// These constructors shall not participate in overload resolution if
|
||||
// decay<F>::type is the same type as std::packaged_task<R(ArgTypes...)>.
|
||||
|
||||
#include <cassert>
|
||||
#include <future>
|
||||
|
||||
#include "test_allocator.h"
|
||||
|
||||
struct A {};
|
||||
using PT = std::packaged_task<A(int, char)>;
|
||||
using VPT = volatile std::packaged_task<A(int, char)>;
|
||||
|
||||
static_assert(!std::is_constructible<PT, std::allocator_arg_t, test_allocator<A>, VPT>::value, "");
|
||||
|
||||
using PA = std::packaged_task<A(int)>;
|
||||
using PI = std::packaged_task<int(int)>;
|
||||
|
||||
static_assert(!std::is_constructible<PA, std::allocator_arg_t, std::allocator<A>, const PA&>::value, "");
|
||||
static_assert(!std::is_constructible<PA, std::allocator_arg_t, std::allocator<A>, const PA&&>::value, "");
|
||||
static_assert(!std::is_constructible<PA, std::allocator_arg_t, std::allocator<A>, volatile PA&>::value, "");
|
||||
static_assert(!std::is_constructible<PA, std::allocator_arg_t, std::allocator<A>, volatile PA&&>::value, "");
|
||||
|
||||
static_assert( std::is_constructible<PA, std::allocator_arg_t, std::allocator<A>, const PI&>::value, "");
|
||||
static_assert( std::is_constructible<PA, std::allocator_arg_t, std::allocator<A>, const PI&&>::value, "");
|
||||
static_assert( std::is_constructible<PA, std::allocator_arg_t, std::allocator<A>, volatile PI&>::value, "");
|
||||
static_assert( std::is_constructible<PA, std::allocator_arg_t, std::allocator<A>, volatile PI&&>::value, "");
|
|
@ -1,35 +0,0 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// UNSUPPORTED: c++03
|
||||
|
||||
// <future>
|
||||
|
||||
// class packaged_task<R(ArgTypes...)>
|
||||
// template <class F, class Allocator>
|
||||
// packaged_task(allocator_arg_t, const Allocator& a, F&& f);
|
||||
// These constructors shall not participate in overload resolution if
|
||||
// decay<F>::type is the same type as std::packaged_task<R(ArgTypes...)>.
|
||||
|
||||
#include <future>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_allocator.h"
|
||||
|
||||
struct A {};
|
||||
typedef std::packaged_task<A(int, char)> PT;
|
||||
typedef volatile std::packaged_task<A(int, char)> VPT;
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
PT p { std::allocator_arg_t{}, test_allocator<A>{}, VPT {}}; // expected-error {{no matching constructor for initialization of 'PT' (aka 'packaged_task<A (int, char)>')}}
|
||||
// expected-note-re@future:* 1 {{candidate template ignored: {{(disabled by 'enable_if')|(requirement '.*' was not satisfied)}}}}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue