[libcxx-commits] [PATCH] D60724: [libc++] Make __debug_less::operator() constexpr
Tom Anderson via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 18 17:51:10 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL358725: [libc++] Make __debug_less::operator() constexpr (authored by thomasanderson, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D60724?vs=195846&id=195847#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60724/new/
https://reviews.llvm.org/D60724
Files:
libcxx/trunk/include/algorithm
libcxx/trunk/test/libcxx/algorithms/debug_less.pass.cpp
Index: libcxx/trunk/include/algorithm
===================================================================
--- libcxx/trunk/include/algorithm
+++ libcxx/trunk/include/algorithm
@@ -785,6 +785,7 @@
__debug_less(_Compare& __c) : __comp_(__c) {}
template <class _Tp, class _Up>
+ _LIBCPP_CONSTEXPR_AFTER_CXX17
bool operator()(const _Tp& __x, const _Up& __y)
{
bool __r = __comp_(__x, __y);
Index: libcxx/trunk/test/libcxx/algorithms/debug_less.pass.cpp
===================================================================
--- libcxx/trunk/test/libcxx/algorithms/debug_less.pass.cpp
+++ libcxx/trunk/test/libcxx/algorithms/debug_less.pass.cpp
@@ -268,6 +268,16 @@
assert(dl(static_cast<int&&>(1), static_cast<const int&&>(2)));
}
+#if TEST_STD_VER > 17
+constexpr bool test_constexpr() {
+ std::less<> cmp{};
+ __debug_less<std::less<> > dcmp(cmp);
+ assert(dcmp(1, 2));
+ assert(!dcmp(1, 1));
+ return true;
+}
+#endif
+
int main(int, char**) {
test_passing();
test_failing();
@@ -275,5 +285,8 @@
test_non_const_arg_cmp();
test_value_iterator();
test_value_categories();
+#if TEST_STD_VER > 17
+ static_assert(test_constexpr(), "");
+#endif
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60724.195847.patch
Type: text/x-patch
Size: 1241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190419/ac1ea2bd/attachment.bin>
More information about the libcxx-commits
mailing list