[libcxx-commits] [PATCH] D65721: Make rotate a constexpr

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 25 08:33:45 PDT 2020


ldionne requested changes to this revision.
ldionne added inline comments.
This revision now requires changes to proceed.


================
Comment at: libcxx/include/algorithm:2504
 inline _LIBCPP_INLINE_VISIBILITY
-_RandomAccessIterator
+_LIBCPP_CONSTEXPR_AFTER_CXX11 _RandomAccessIterator
 __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
----------------
This can't be `constexpr` in C++14 since it uses `__rotate_forward`, which is only marked as `constexpr` starting in C++17 and above.


================
Comment at: libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp:133
 
+#if TEST_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
+    static_assert(test<input_iterator<const int*>, input_iterator<int*> >());
----------------
I would remove `&& !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)` -- the test suite isn't supposed to have libc++ or compiler specific knowledge. If the test fails with some older compilers (e.g. clang 5), we can mark it as unsupported on that compiler.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65721/new/

https://reviews.llvm.org/D65721





More information about the libcxx-commits mailing list