forked from OSchip/llvm-project
Fix __is_referenceable to work with vector types. Fixes PR#26654 and 26656. Thanks to Evgeniy for the reports, and to Eric for the suggestion on how to fix it.
llvm-svn: 261581
This commit is contained in:
parent
0c6bd7b0d3
commit
9b4880e7ec
|
@ -959,34 +959,15 @@ template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
|
||||||
|
|
||||||
|
|
||||||
// __is_referenceable [defns.referenceable]
|
// __is_referenceable [defns.referenceable]
|
||||||
template <class _Tp> struct __is_referenceable
|
|
||||||
: public std::integral_constant<bool, is_object<_Tp>::value || is_reference<_Tp>::value> {};
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
struct __is_referenceable_impl {
|
||||||
template <class _Ret, class... _Args>
|
template <class _Tp> static _Tp& __test(int);
|
||||||
struct __is_referenceable<_Ret(_Args...)> : public std::true_type {};
|
template <class _Tp> static __two __test(...);
|
||||||
|
};
|
||||||
|
|
||||||
template <class _Ret, class... _Args>
|
template <class _Tp>
|
||||||
struct __is_referenceable<_Ret(_Args..., ...)> : public std::true_type {};
|
struct __is_referenceable : std::integral_constant<bool,
|
||||||
#else
|
!std::is_same<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value> {};
|
||||||
template <class _Ret>
|
|
||||||
struct __is_referenceable<_Ret()> : public std::true_type {};
|
|
||||||
template <class _Ret, class _A0>
|
|
||||||
struct __is_referenceable<_Ret(_A0)> : public std::true_type {};
|
|
||||||
template <class _Ret, class _A0, class _A1>
|
|
||||||
struct __is_referenceable<_Ret(_A0, _A1)> : public std::true_type {};
|
|
||||||
template <class _Ret, class _A0, class _A1, class _A2>
|
|
||||||
struct __is_referenceable<_Ret(_A0, _A1, _A2)> : public std::true_type {};
|
|
||||||
|
|
||||||
template <class _Ret>
|
|
||||||
struct __is_referenceable<_Ret(...)> : public std::true_type {};
|
|
||||||
template <class _Ret, class _A0>
|
|
||||||
struct __is_referenceable<_Ret(_A0, ...)> : public std::true_type {};
|
|
||||||
template <class _Ret, class _A0, class _A1>
|
|
||||||
struct __is_referenceable<_Ret(_A0, _A1, ...)> : public std::true_type {};
|
|
||||||
template <class _Ret, class _A0, class _A1, class _A2>
|
|
||||||
struct __is_referenceable<_Ret(_A0, _A1, _A2, ...)> : public std::true_type {};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// add_const
|
// add_const
|
||||||
|
|
|
@ -39,6 +39,11 @@ static_assert(( std::__is_referenceable<Foo &&>::value), "");
|
||||||
static_assert(( std::__is_referenceable<const Foo &&>::value), "");
|
static_assert(( std::__is_referenceable<const Foo &&>::value), "");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static_assert(( std::__is_referenceable<int __attribute__((__vector_size__( 8)))>::value), "");
|
||||||
|
static_assert(( std::__is_referenceable<const int __attribute__((__vector_size__( 8)))>::value), "");
|
||||||
|
static_assert(( std::__is_referenceable<float __attribute__((__vector_size__(16)))>::value), "");
|
||||||
|
static_assert(( std::__is_referenceable<const float __attribute__((__vector_size__(16)))>::value), "");
|
||||||
|
|
||||||
// Functions without cv-qualifiers are referenceable
|
// Functions without cv-qualifiers are referenceable
|
||||||
static_assert(( std::__is_referenceable<void ()>::value), "");
|
static_assert(( std::__is_referenceable<void ()>::value), "");
|
||||||
#if TEST_STD_VER >= 11
|
#if TEST_STD_VER >= 11
|
||||||
|
|
Loading…
Reference in New Issue