public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94565] New: C++20: Comparing comparison category types against 0/nullptr is not noexcept
@ 2020-04-11 21:27 daniel.kruegler at googlemail dot com
  2020-04-13 20:25 ` [Bug libstdc++/94565] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2020-04-11 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94565
           Summary: C++20: Comparing comparison category types against
                    0/nullptr is not noexcept
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.kruegler at googlemail dot com
  Target Milestone: ---

The following program should be accepted, but is rejected due to a violation of
the static_assertion:

Compiler options:

-Wall -Wextra -pedantic "-std=c++20"

//---------------------
#include <compare>

int main()
{
  static_assert(noexcept(std::partial_ordering::less == 0));
}
//---------------------

prog.cc: In function 'int main()':
prog.cc:5:17: error: static assertion failed
    5 |   static_assert(noexcept(std::partial_ordering::less == 0));
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The corresponding comparison functions for are all declared as noexcept
([cmp.partialord], [cmp.weakord], [cmp.strongord]), so the clear intention is
that such an comparison should be observable as non-throwing operations. The
reason why above test fails for all of the existing mixed comparison functions
of all the three comparison category types against 0/nullptr is caused by the
fact that the implementation-internal type std::__cmp_cat::__unspec in header
<compare> misses to declare its converting constructor as noexcept:

struct __unspec
    {
      constexpr __unspec(__unspec*) { }
    };

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

* [Bug libstdc++/94565] C++20: Comparing comparison category types against 0/nullptr is not noexcept
  2020-04-11 21:27 [Bug libstdc++/94565] New: C++20: Comparing comparison category types against 0/nullptr is not noexcept daniel.kruegler at googlemail dot com
@ 2020-04-13 20:25 ` redi at gcc dot gnu.org
  2020-04-14 10:43 ` cvs-commit at gcc dot gnu.org
  2020-04-14 10:44 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-13 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-04-13
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.0
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org

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

* [Bug libstdc++/94565] C++20: Comparing comparison category types against 0/nullptr is not noexcept
  2020-04-11 21:27 [Bug libstdc++/94565] New: C++20: Comparing comparison category types against 0/nullptr is not noexcept daniel.kruegler at googlemail dot com
  2020-04-13 20:25 ` [Bug libstdc++/94565] " redi at gcc dot gnu.org
@ 2020-04-14 10:43 ` cvs-commit at gcc dot gnu.org
  2020-04-14 10:44 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-14 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 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:597601aa7a0f822816041d521fae7da6e883fa7d

commit r10-7710-g597601aa7a0f822816041d521fae7da6e883fa7d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Apr 14 11:23:34 2020 +0100

    libstdc++: Make comparison category comparisons noexcept (PR 94565)

            PR libstdc++/94565
            * libsupc++/compare (__unspec): Add noexcept-specifier to
constructor.
            * testsuite/18_support/comparisons/categories/94565.cc: New test.

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

* [Bug libstdc++/94565] C++20: Comparing comparison category types against 0/nullptr is not noexcept
  2020-04-11 21:27 [Bug libstdc++/94565] New: C++20: Comparing comparison category types against 0/nullptr is not noexcept daniel.kruegler at googlemail dot com
  2020-04-13 20:25 ` [Bug libstdc++/94565] " redi at gcc dot gnu.org
  2020-04-14 10:43 ` cvs-commit at gcc dot gnu.org
@ 2020-04-14 10:44 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-14 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-04-14 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-11 21:27 [Bug libstdc++/94565] New: C++20: Comparing comparison category types against 0/nullptr is not noexcept daniel.kruegler at googlemail dot com
2020-04-13 20:25 ` [Bug libstdc++/94565] " redi at gcc dot gnu.org
2020-04-14 10:43 ` cvs-commit at gcc dot gnu.org
2020-04-14 10:44 ` redi 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).