[libc++] Remove _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED.

Zoe Carver says: "We decided that libc++ only supports C++20 constexpr algorithms
when `is_constant_evaluated` is also supported. Here's a link to the discussion."
https://reviews.llvm.org/D65721#inline-735682

Remove _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED from tests, too.
See Louis's 5911e6a885 if needed to fix bots.
I've applied `UNSUPPORTED: clang-8` preemptively to the altered tests;
I don't know for sure that this was needed, because no clang-8 buildbots
are triggered on pull requests.
This commit is contained in:
Arthur O'Dwyer 2020-11-23 12:44:41 -05:00
parent 9e83d0bcdf
commit ee95c7020c
15 changed files with 52 additions and 36 deletions

View File

@ -1029,14 +1029,6 @@ typedef unsigned int char32_t;
# define _LIBCPP_CONSTEXPR_AFTER_CXX17
#endif
#if _LIBCPP_STD_VER > 17 && \
!defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) && \
!defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED constexpr
#else
# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
#endif
// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
// NODISCARD macros to the correct attribute.
#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)

View File

@ -318,7 +318,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
// constexpr versions of move/copy/assign.
template <class _CharT>
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
_CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
{
if (__n == 0) return __s1;
@ -331,7 +331,7 @@ _CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
}
template <class _CharT>
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
_CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
{
_VSTD::copy_n(__s2, __n, __s1);
@ -339,7 +339,7 @@ _CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
}
template <class _CharT>
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT
{
_VSTD::fill_n(__s, __n, __a);
@ -370,14 +370,14 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
static _LIBCPP_CONSTEXPR_AFTER_CXX14
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
{
return __libcpp_is_constant_evaluated()
? __move_constexpr(__s1, __s2, __n)
: __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
}
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
{
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
@ -385,7 +385,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
? __copy_constexpr(__s1, __s2, __n)
: __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
}
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
{
return __libcpp_is_constant_evaluated()
@ -473,14 +473,14 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
size_t length(const char_type* __s) _NOEXCEPT;
static _LIBCPP_CONSTEXPR_AFTER_CXX14
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
{
return __libcpp_is_constant_evaluated()
? __move_constexpr(__s1, __s2, __n)
: __n == 0 ? __s1 : wmemmove(__s1, __s2, __n);
}
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
{
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
@ -488,7 +488,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
? __copy_constexpr(__s1, __s2, __n)
: __n == 0 ? __s1 : wmemcpy(__s1, __s2, __n);
}
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
{
return __libcpp_is_constant_evaluated()
@ -606,7 +606,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
_LIBCPP_INLINE_VISIBILITY static constexpr
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
{
return __libcpp_is_constant_evaluated()
@ -614,7 +614,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
: __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
}
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
{
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
@ -623,7 +623,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
: __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
}
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
static _LIBCPP_CONSTEXPR_AFTER_CXX17
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
{
return __libcpp_is_constant_evaluated()

View File

@ -1727,7 +1727,7 @@ __copy(_Tp* __first, _Tp* __last, _Up* __result)
}
template <class _InputIterator, class _OutputIterator>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
_OutputIterator
copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
{
@ -1780,7 +1780,7 @@ __copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
}
template <class _BidirectionalIterator1, class _BidirectionalIterator2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
_BidirectionalIterator2
copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
_BidirectionalIterator2 __result)
@ -1818,7 +1818,7 @@ copy_if(_InputIterator __first, _InputIterator __last,
// copy_n
template<class _InputIterator, class _Size, class _OutputIterator>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
typename enable_if
<
__is_cpp17_input_iterator<_InputIterator>::value &&
@ -1844,7 +1844,7 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
}
template<class _InputIterator, class _Size, class _OutputIterator>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
typename enable_if
<
__is_cpp17_random_access_iterator<_InputIterator>::value,

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <algorithm>
// template<InputIterator InIter, OutputIterator<auto, InIter::reference> OutIter>
@ -79,7 +81,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <algorithm>
// template<BidirectionalIterator InIter, BidirectionalIterator OutIter>
@ -58,7 +60,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <algorithm>
// template<InputIterator InIter, OutputIterator<auto, InIter::reference> OutIter>
@ -82,7 +84,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <string>
// template<> struct char_traits<char>
@ -33,7 +35,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <string>
// template<> struct char_traits<char>
@ -35,7 +37,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <string>
// template<> struct char_traits<char>
@ -39,7 +41,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -5,7 +5,9 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-8
// <string>
@ -36,7 +38,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -5,7 +5,9 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-8
// <string>
@ -38,7 +40,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -5,7 +5,9 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: clang-8
// <string>
@ -42,7 +44,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <string>
// template<> struct char_traits<wchar_t>
@ -33,7 +35,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <string>
// template<> struct char_traits<wchar_t>
@ -35,7 +37,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: clang-8
// <string>
// template<> struct char_traits<wchar_t>
@ -39,7 +41,7 @@ int main(int, char**)
{
test();
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
#if TEST_STD_VER > 17
static_assert(test());
#endif