[libcxx] r271473 - Mark LWG issue 2450 as complete.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 1 20:12:44 PDT 2016
Author: ericwf
Date: Wed Jun 1 22:12:44 2016
New Revision: 271473
URL: http://llvm.org/viewvc/llvm-project?rev=271473&view=rev
Log:
Mark LWG issue 2450 as complete.
Added:
libcxx/trunk/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp
Modified:
libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
libcxx/trunk/www/cxx1z_status.html
Modified: libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp?rev=271473&r1=271472&r2=271473&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp Wed Jun 1 22:12:44 2016
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::equal_to<int> F;
@@ -24,7 +26,7 @@ int main()
static_assert((std::is_same<bool, F::result_type>::value), "" );
assert(f(36, 36));
assert(!f(36, 6));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::equal_to<> F2;
const F2 f2 = F2();
assert(f2(36, 36));
Modified: libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp?rev=271473&r1=271472&r2=271473&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp Wed Jun 1 22:12:44 2016
@@ -15,6 +15,9 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
int main()
{
typedef std::greater<int> F;
@@ -25,7 +28,12 @@ int main()
assert(!f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
-#if _LIBCPP_STD_VER > 11
+ {
+ // test total ordering of int* for greater<int*> and
+ // greater<void>.
+ do_pointer_comparison_test<int, std::greater>();
+ }
+#if TEST_STD_VER > 11
typedef std::greater<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
Modified: libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp?rev=271473&r1=271472&r2=271473&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp Wed Jun 1 22:12:44 2016
@@ -15,6 +15,9 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
int main()
{
typedef std::greater_equal<int> F;
@@ -25,7 +28,12 @@ int main()
assert(f(36, 36));
assert(f(36, 6));
assert(!f(6, 36));
-#if _LIBCPP_STD_VER > 11
+ {
+ // test total ordering of int* for greater_equal<int*> and
+ // greater_equal<void>.
+ do_pointer_comparison_test<int, std::greater_equal>();
+ }
+#if TEST_STD_VER > 11
typedef std::greater_equal<> F2;
const F2 f2 = F2();
assert(f2(36, 36));
Modified: libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp?rev=271473&r1=271472&r2=271473&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/comparisons/less.pass.cpp Wed Jun 1 22:12:44 2016
@@ -15,6 +15,9 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
int main()
{
typedef std::less<int> F;
@@ -25,7 +28,11 @@ int main()
assert(!f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
-#if _LIBCPP_STD_VER > 11
+ {
+ // test total ordering of int* for less<int*> and less<void>.
+ do_pointer_comparison_test<int, std::less>();
+ }
+#if TEST_STD_VER > 11
typedef std::less<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
Modified: libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp?rev=271473&r1=271472&r2=271473&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp Wed Jun 1 22:12:44 2016
@@ -15,6 +15,9 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+#include "pointer_comparison_test_helper.hpp"
+
int main()
{
typedef std::less_equal<int> F;
@@ -25,7 +28,12 @@ int main()
assert(f(36, 36));
assert(!f(36, 6));
assert(f(6, 36));
-#if _LIBCPP_STD_VER > 11
+ {
+ // test total ordering of int* for less_equal<int*> and
+ // less_equal<void>.
+ do_pointer_comparison_test<int, std::less_equal>();
+ }
+#if TEST_STD_VER > 11
typedef std::less_equal<> F2;
const F2 f2 = F2();
assert( f2(36, 36));
Modified: libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp?rev=271473&r1=271472&r2=271473&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp Wed Jun 1 22:12:44 2016
@@ -15,6 +15,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
typedef std::not_equal_to<int> F;
@@ -24,7 +26,7 @@ int main()
static_assert((std::is_same<bool, F::result_type>::value), "" );
assert(!f(36, 36));
assert(f(36, 6));
-#if _LIBCPP_STD_VER > 11
+#if TEST_STD_VER > 11
typedef std::not_equal_to<> F2;
const F2 f2 = F2();
assert(!f2(36, 36));
Added: libcxx/trunk/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp?rev=271473&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp (added)
+++ libcxx/trunk/test/std/utilities/function.objects/comparisons/pointer_comparison_test_helper.hpp Wed Jun 1 22:12:44 2016
@@ -0,0 +1,39 @@
+#ifndef POINTER_COMPARISON_TEST_HELPER_HPP
+#define POINTER_COMPARISON_TEST_HELPER_HPP
+
+#include <vector>
+#include <memory>
+#include <cstdint>
+#include <cassert>
+
+#include "test_macros.h"
+
+template <class T, template<class> class CompareTemplate>
+void do_pointer_comparison_test() {
+ typedef CompareTemplate<T*> Compare;
+ typedef CompareTemplate<std::uintptr_t> UIntCompare;
+#if TEST_STD_VER > 11
+ typedef CompareTemplate<void> VoidCompare;
+#else
+ typedef Compare VoidCompare;
+#endif
+ std::vector<std::shared_ptr<T> > pointers;
+ const std::size_t test_size = 100;
+ for (int i=0; i < test_size; ++i)
+ pointers.push_back(std::shared_ptr<T>(new T()));
+ Compare comp;
+ UIntCompare ucomp;
+ VoidCompare vcomp;
+ for (int i=0; i < test_size; ++i) {
+ for (int j=0; j < test_size; ++j) {
+ T* lhs = pointers[i].get();
+ T* rhs = pointers[j].get();
+ std::uintptr_t lhs_uint = reinterpret_cast<std::uintptr_t>(lhs);
+ std::uintptr_t rhs_uint = reinterpret_cast<std::uintptr_t>(rhs);
+ assert(comp(lhs, rhs) == ucomp(lhs_uint, rhs_uint));
+ assert(vcomp(lhs, rhs) == ucomp(lhs_uint, rhs_uint));
+ }
+ }
+}
+
+#endif // POINTER_COMPARISON_TEST_HELPER_HPP
Modified: libcxx/trunk/www/cxx1z_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=271473&r1=271472&r2=271473&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Wed Jun 1 22:12:44 2016
@@ -205,7 +205,7 @@
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2192">2192</a></td><td>Validity and return type of <tt>std::abs(0u)</tt> is unclear</td><td>Jacksonville</td><td></td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2276">2276</a></td><td>Missing requirement on <tt>std::promise::set_exception</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2296">2296</a></td><td><tt>std::addressof</tt> should be <tt>constexpr</td><td>Jacksonville</td><td>Complete (Clang Only)</td></tr>
- <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2450">2450</a></td><td><tt>(greater|less|greater_equal|less_equal)<void></tt> do not yield a total order for pointers</td><td>Jacksonville</td><td></td></tr>
+ <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2450">2450</a></td><td><tt>(greater|less|greater_equal|less_equal)<void></tt> do not yield a total order for pointers</td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2520">2520</a></td><td>N4089 broke initializing <tt>unique_ptr<T[]></tt> from a <tt>nullptr</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2522">2522</a></td><td>[fund.ts.v2] Contradiction in <tt>set_default_resource</tt> specification</td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2523">2523</a></td><td><tt>std::promise</tt> synopsis shows two <tt>set_value_at_thread_exit()</tt>'s for no apparent reason</td><td>Jacksonville</td><td>Complete</td></tr>
More information about the cfe-commits
mailing list