public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/93628] ranges::equal_to doesn't work for types convertible to function pointers
       [not found] <bug-93628-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-15 19:36 ` redi at gcc dot gnu.org
  2021-03-09 11:17 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-15 19:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93628

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-15
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/93628] ranges::equal_to doesn't work for types convertible to function pointers
       [not found] <bug-93628-4@http.gcc.gnu.org/bugzilla/>
  2020-04-15 19:36 ` [Bug libstdc++/93628] ranges::equal_to doesn't work for types convertible to function pointers redi at gcc dot gnu.org
@ 2021-03-09 11:17 ` redi at gcc dot gnu.org
  2021-03-10 15:28 ` cvs-commit at gcc dot gnu.org
  2021-03-29 20:03 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-03-09 11:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93628

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
LWG 3530 should mean we don't have to support such silly types.
https://wg21.link/lwg3530

However, we are still required to impose a total order on function pointers,
which means ranges::less/greater/less_equal/greater_equal are still
(potentially) broken, as for object pointers in PR 78420. We might get away
with it if the compiler doesn't do similar optimizations for function pointers,
but we used to say that about object pointers too, and it stopped being true.

As noted above, we don't have a way to detect that a relational comparison
would call a built-in operator on function pointers. Maybe what we want is a
__builtin_less_than(t, u) which is t < u but with a total order.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/93628] ranges::equal_to doesn't work for types convertible to function pointers
       [not found] <bug-93628-4@http.gcc.gnu.org/bugzilla/>
  2020-04-15 19:36 ` [Bug libstdc++/93628] ranges::equal_to doesn't work for types convertible to function pointers redi at gcc dot gnu.org
  2021-03-09 11:17 ` redi at gcc dot gnu.org
@ 2021-03-10 15:28 ` cvs-commit at gcc dot gnu.org
  2021-03-29 20:03 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-10 15:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93628

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:dddd011113b6ceede733d7ae33eca695c06b181b

commit r11-7603-gdddd011113b6ceede733d7ae33eca695c06b181b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Mar 10 15:27:06 2021 +0000

    libstdc++: Implement LWG 3530 for concept-constrained comparisons

    The proposed resolution for this library issue simplifies the
    constraints for compare_three_way, ranges::equal_to, ranges::less etc.
    so that they do not work with types which are convertible to pointers
    but which fail to meet the usual syntactic requirements for the
    comparisons.

    This affects the example in PR libstdc++/93628 but doesn't fix the
    problem described in that report.

    libstdc++-v3/ChangeLog:

            * include/bits/ranges_cmp.h (__eq_builtin_ptr_cmp): Remove.
            (ranges::equal_to, ranges::not_equal_to): Do not constrain
            with __eq_builtin_ptr_cmp.
            (ranges::less, ranges::greater, ranges::less_equal)
            (ranges::greater_equal): Do not constrain with
            __less_builtin_ptr_cmp.
            * libsupc++/compare (compare_three_way): Do not constrain with
            __3way_builtin_ptr_cmp.
            * testsuite/18_support/comparisons/object/builtin-ptr-three-way.cc:
Moved to...
            * testsuite/18_support/comparisons/object/lwg3530.cc: ...here.
            * testsuite/20_util/function_objects/range.cmp/lwg3530.cc: New
test.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/93628] ranges::equal_to doesn't work for types convertible to function pointers
       [not found] <bug-93628-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-03-10 15:28 ` cvs-commit at gcc dot gnu.org
@ 2021-03-29 20:03 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-29 20:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93628

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:913312de92522e9e6696331fc3018e1020845c26

commit r10-9591-g913312de92522e9e6696331fc3018e1020845c26
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Mar 10 15:27:06 2021 +0000

    libstdc++: Implement LWG 3530 for concept-constrained comparisons

    The proposed resolution for this library issue simplifies the
    constraints for compare_three_way, ranges::equal_to, ranges::less etc.
    so that they do not work with types which are convertible to pointers
    but which fail to meet the usual syntactic requirements for the
    comparisons.

    This affects the example in PR libstdc++/93628 but doesn't fix the
    problem described in that report.

    libstdc++-v3/ChangeLog:

            * include/bits/range_cmp.h (__eq_builtin_ptr_cmp): Remove.
            (ranges::equal_to, ranges::not_equal_to): Do not constrain
            with __eq_builtin_ptr_cmp.
            (ranges::less, ranges::greater, ranges::less_equal)
            (ranges::greater_equal): Do not constrain with
            __less_builtin_ptr_cmp.
            * libsupc++/compare (compare_three_way): Do not constrain with
            __3way_builtin_ptr_cmp.
            * testsuite/18_support/comparisons/object/builtin-ptr-three-way.cc:
Moved to...
            * testsuite/18_support/comparisons/object/lwg3530.cc: ...here.
            * testsuite/20_util/function_objects/range.cmp/lwg3530.cc: New
test.

    (cherry picked from commit dddd011113b6ceede733d7ae33eca695c06b181b)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-29 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93628-4@http.gcc.gnu.org/bugzilla/>
2020-04-15 19:36 ` [Bug libstdc++/93628] ranges::equal_to doesn't work for types convertible to function pointers redi at gcc dot gnu.org
2021-03-09 11:17 ` redi at gcc dot gnu.org
2021-03-10 15:28 ` cvs-commit at gcc dot gnu.org
2021-03-29 20:03 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).