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
After this patch, the following C++20 test case seems to work okay for me in all its configurations:
// clang++ -std=c++20 -DX=0 should work
// clang++ -std=c++20 -DX=1 should work
// clang++ -std=c++20 -DX=2 should work
// clang++ -std=c++20 -DX=3 should not work
#if X & 1
#define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
#endif
#include <algorithm>
constexpr int test() {
int x[10] {};
int y[10] {};
std::copy(x, x+10, y);
std::copy_n(x, 10, y);
std::move(x, x+10, y);
std::copy_backward(x, x+10, y+10);
std::move_backward(x, x+10, y+10);
return 0;
}
int main() {
#if X & 2
constexpr int i = test();
#else
const int i = test();
#endif
}
(commenting here just so we get nice comment threading)
Aw, phooey. @ldionne, do you think it would make sense to preemptively // UNSUPPORTED: clang-8 on these char_traits tests I'm changing?
If you're expecting buildbot breakage, which likely @ldionne will be the one to fix and Arthur won't, then I suggest that @ldionne should be the one to land this patch. Or else Slack me so that we can both be paying attention at the same time. I just don't want to land it right before you go to sleep or something.