Skip to content

Commit ee95c70

Browse files
committed
[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 5911e6a 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.
1 parent 9e83d0b commit ee95c70

File tree

15 files changed

+52
-36
lines changed

15 files changed

+52
-36
lines changed

libcxx/include/__config

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,14 +1029,6 @@ typedef unsigned int char32_t;
10291029
# define _LIBCPP_CONSTEXPR_AFTER_CXX17
10301030
#endif
10311031

1032-
#if _LIBCPP_STD_VER > 17 && \
1033-
!defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) && \
1034-
!defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
1035-
# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED constexpr
1036-
#else
1037-
# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1038-
#endif
1039-
10401032
// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
10411033
// NODISCARD macros to the correct attribute.
10421034
#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)

libcxx/include/__string

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
318318
// constexpr versions of move/copy/assign.
319319

320320
template <class _CharT>
321-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
321+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
322322
_CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
323323
{
324324
if (__n == 0) return __s1;
@@ -331,15 +331,15 @@ _CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
331331
}
332332

333333
template <class _CharT>
334-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
334+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
335335
_CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
336336
{
337337
_VSTD::copy_n(__s2, __n, __s1);
338338
return __s1;
339339
}
340340

341341
template <class _CharT>
342-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
342+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
343343
_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT
344344
{
345345
_VSTD::fill_n(__s, __n, __a);
@@ -370,22 +370,22 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
370370
length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
371371
static _LIBCPP_CONSTEXPR_AFTER_CXX14
372372
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
373-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
373+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
374374
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
375375
{
376376
return __libcpp_is_constant_evaluated()
377377
? __move_constexpr(__s1, __s2, __n)
378378
: __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
379379
}
380-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
380+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
381381
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
382382
{
383383
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
384384
return __libcpp_is_constant_evaluated()
385385
? __copy_constexpr(__s1, __s2, __n)
386386
: __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
387387
}
388-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
388+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
389389
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
390390
{
391391
return __libcpp_is_constant_evaluated()
@@ -473,22 +473,22 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
473473
size_t length(const char_type* __s) _NOEXCEPT;
474474
static _LIBCPP_CONSTEXPR_AFTER_CXX14
475475
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
476-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
476+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
477477
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
478478
{
479479
return __libcpp_is_constant_evaluated()
480480
? __move_constexpr(__s1, __s2, __n)
481481
: __n == 0 ? __s1 : wmemmove(__s1, __s2, __n);
482482
}
483-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
483+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
484484
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
485485
{
486486
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
487487
return __libcpp_is_constant_evaluated()
488488
? __copy_constexpr(__s1, __s2, __n)
489489
: __n == 0 ? __s1 : wmemcpy(__s1, __s2, __n);
490490
}
491-
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
491+
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
492492
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
493493
{
494494
return __libcpp_is_constant_evaluated()
@@ -606,15 +606,15 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
606606
_LIBCPP_INLINE_VISIBILITY static constexpr
607607
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
608608

609-
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
609+
static _LIBCPP_CONSTEXPR_AFTER_CXX17
610610
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
611611
{
612612
return __libcpp_is_constant_evaluated()
613613
? __move_constexpr(__s1, __s2, __n)
614614
: __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
615615
}
616616

617-
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
617+
static _LIBCPP_CONSTEXPR_AFTER_CXX17
618618
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
619619
{
620620
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
@@ -623,7 +623,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
623623
: __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
624624
}
625625

626-
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
626+
static _LIBCPP_CONSTEXPR_AFTER_CXX17
627627
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
628628
{
629629
return __libcpp_is_constant_evaluated()

libcxx/include/algorithm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ __copy(_Tp* __first, _Tp* __last, _Up* __result)
17271727
}
17281728

17291729
template <class _InputIterator, class _OutputIterator>
1730-
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1730+
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
17311731
_OutputIterator
17321732
copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
17331733
{
@@ -1780,7 +1780,7 @@ __copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
17801780
}
17811781

17821782
template <class _BidirectionalIterator1, class _BidirectionalIterator2>
1783-
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1783+
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
17841784
_BidirectionalIterator2
17851785
copy_backward(_BidirectionalIterator1 __first, _BidirectionalIterator1 __last,
17861786
_BidirectionalIterator2 __result)
@@ -1818,7 +1818,7 @@ copy_if(_InputIterator __first, _InputIterator __last,
18181818
// copy_n
18191819

18201820
template<class _InputIterator, class _Size, class _OutputIterator>
1821-
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1821+
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
18221822
typename enable_if
18231823
<
18241824
__is_cpp17_input_iterator<_InputIterator>::value &&
@@ -1844,7 +1844,7 @@ copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
18441844
}
18451845

18461846
template<class _InputIterator, class _Size, class _OutputIterator>
1847-
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
1847+
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
18481848
typename enable_if
18491849
<
18501850
__is_cpp17_random_access_iterator<_InputIterator>::value,

libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <algorithm>
1012

1113
// template<InputIterator InIter, OutputIterator<auto, InIter::reference> OutIter>
@@ -79,7 +81,7 @@ int main(int, char**)
7981
{
8082
test();
8183

82-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
84+
#if TEST_STD_VER > 17
8385
static_assert(test());
8486
#endif
8587

libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <algorithm>
1012

1113
// template<BidirectionalIterator InIter, BidirectionalIterator OutIter>
@@ -58,7 +60,7 @@ int main(int, char**)
5860
{
5961
test();
6062

61-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
63+
#if TEST_STD_VER > 17
6264
static_assert(test());
6365
#endif
6466

libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <algorithm>
1012

1113
// template<InputIterator InIter, OutputIterator<auto, InIter::reference> OutIter>
@@ -82,7 +84,7 @@ int main(int, char**)
8284
{
8385
test();
8486

85-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
87+
#if TEST_STD_VER > 17
8688
static_assert(test());
8789
#endif
8890

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/assign3.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <string>
1012

1113
// template<> struct char_traits<char>
@@ -33,7 +35,7 @@ int main(int, char**)
3335
{
3436
test();
3537

36-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
38+
#if TEST_STD_VER > 17
3739
static_assert(test());
3840
#endif
3941

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/copy.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <string>
1012

1113
// template<> struct char_traits<char>
@@ -35,7 +37,7 @@ int main(int, char**)
3537
{
3638
test();
3739

38-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
40+
#if TEST_STD_VER > 17
3941
static_assert(test());
4042
#endif
4143

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/move.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <string>
1012

1113
// template<> struct char_traits<char>
@@ -39,7 +41,7 @@ int main(int, char**)
3941
{
4042
test();
4143

42-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
44+
#if TEST_STD_VER > 17
4345
static_assert(test());
4446
#endif
4547

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/assign3.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
89
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
// UNSUPPORTED: clang-8
911

1012
// <string>
1113

@@ -36,7 +38,7 @@ int main(int, char**)
3638
{
3739
test();
3840

39-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
41+
#if TEST_STD_VER > 17
4042
static_assert(test());
4143
#endif
4244

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/copy.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
89
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
// UNSUPPORTED: clang-8
911

1012
// <string>
1113

@@ -38,7 +40,7 @@ int main(int, char**)
3840
{
3941
test();
4042

41-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
43+
#if TEST_STD_VER > 17
4244
static_assert(test());
4345
#endif
4446

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/move.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
89
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
// UNSUPPORTED: clang-8
911

1012
// <string>
1113

@@ -42,7 +44,7 @@ int main(int, char**)
4244
{
4345
test();
4446

45-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
47+
#if TEST_STD_VER > 17
4648
static_assert(test());
4749
#endif
4850

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/assign3.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <string>
1012

1113
// template<> struct char_traits<wchar_t>
@@ -33,7 +35,7 @@ int main(int, char**)
3335
{
3436
test();
3537

36-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
38+
#if TEST_STD_VER > 17
3739
static_assert(test());
3840
#endif
3941

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/copy.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <string>
1012

1113
// template<> struct char_traits<wchar_t>
@@ -35,7 +37,7 @@ int main(int, char**)
3537
{
3638
test();
3739

38-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
40+
#if TEST_STD_VER > 17
3941
static_assert(test());
4042
#endif
4143

libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/move.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// UNSUPPORTED: clang-8
10+
911
// <string>
1012

1113
// template<> struct char_traits<wchar_t>
@@ -39,7 +41,7 @@ int main(int, char**)
3941
{
4042
test();
4143

42-
#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
44+
#if TEST_STD_VER > 17
4345
static_assert(test());
4446
#endif
4547

0 commit comments

Comments
 (0)