On 09/02/20 13:56 +0000, Jonathan Wakely wrote:
The helpers that implement BUILTIN-PTR-CMP do not currently check if the
arguments are actually comparable, so the concept is true when it
shouldn't be.

Since we're trying to test for an unambiguous conversion to pointers, we
can also require that it returns bool, because the built-in comparisons
for pointers do return bool.

        * include/bits/range_cmp.h (__detail::__eq_builtin_ptr_cmp): Require
        equality comparison to be valid and return bool.
        (__detail::__less_builtin_ptr_cmp): Likewise for less-than comparison.
        * testsuite/20_util/function_objects/range.cmp/equal_to.cc: Check
        type with ambiguous conversion to fundamental types.
        * testsuite/20_util/function_objects/range.cmp/less.cc: Likewise.

This fixes the new comments I added to those tests.

Tested x86_64-linux, committed to master.


commit 38660e87f01dbe15082e83cc4842d66f8d292ba0
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Sun Feb 9 13:58:16 2020 +0000

    libstdc++: Fix names of types in comment
    
            * testsuite/20_util/function_objects/range.cmp/equal_to.cc: Fix
            comment.
            * testsuite/20_util/function_objects/range.cmp/less.ccL Likewise.

diff --git a/libstdc++-v3/testsuite/20_util/function_objects/range.cmp/equal_to.cc b/libstdc++-v3/testsuite/20_util/function_objects/range.cmp/equal_to.cc
index 34f8ee5aca4..2d87b60a8ea 100644
--- a/libstdc++-v3/testsuite/20_util/function_objects/range.cmp/equal_to.cc
+++ b/libstdc++-v3/testsuite/20_util/function_objects/range.cmp/equal_to.cc
@@ -75,7 +75,7 @@ struct Y
   operator int() const;
 };
 
-// X{} == X{} is ambiguous so ranges::equal_to{}(X{}, X{}) should be invalid
+// Y{} == Y{} is ambiguous so ranges::equal_to{}(Y{}, Y{}) should be invalid
 static_assert( !std::is_invocable_v<F&, Y, Y> );
 
 int
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/range.cmp/less.cc b/libstdc++-v3/testsuite/20_util/function_objects/range.cmp/less.cc
index bf7d600e7fe..8c04ad4ea6b 100644
--- a/libstdc++-v3/testsuite/20_util/function_objects/range.cmp/less.cc
+++ b/libstdc++-v3/testsuite/20_util/function_objects/range.cmp/less.cc
@@ -80,7 +80,7 @@ struct Y
   operator int() const;
 };
 
-// X{} == X{} is ambiguous so ranges::less{}(X{}, X{}) should be invalid
+// Y{} == Y{} is ambiguous so ranges::less{}(Y{}, Y{}) should be invalid
 static_assert( !std::is_invocable_v<F&, Y, Y> );
 
 int

Reply via email to