public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/100903] Bogus "zero as null pointer constant" warning
Date: Thu, 16 Nov 2023 15:07:37 +0000	[thread overview]
Message-ID: <bug-100903-4-id9eHnso3D@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100903-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It could also help to overload the comparison operators with constrained
deleted overloads, like so:

    template<typename _Tp>
      concept __not_literal_zero = !convertible_to<_Tp, __unspec>;

    friend constexpr bool
    operator==(partial_ordering, __cmp_cat::__not_literal_zero auto) = delete;

    friend constexpr void
    operator<=>(partial_ordering, __cmp_cat::__not_literal_zero auto) = delete;


With that the "no match for 'operator<'" error  (and its eight accompanying
notes) become:


cmp.cc:7:15: error: use of deleted function 'constexpr void
std::operator<=>(partial_ordering, auto:3) [with auto:3 = long int;
partial_ordering = partial_ordering]'
    7 |   return po > 0L;
      |               ^~
/home/jwakely/gcc/14/include/c++/14.0.0/compare:160:5: note: declared here
  160 |     operator<=>(partial_ordering, __cmp_cat::__not_literal_zero auto) =
delete;
      |     ^~~~~~~~

  parent reply	other threads:[~2023-11-16 15:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04 13:11 [Bug libstdc++/100903] New: " terra at gnome dot org
2021-06-04 14:53 ` [Bug libstdc++/100903] " jakub at gcc dot gnu.org
2021-06-04 16:14 ` terra at gnome dot org
2021-06-04 17:16 ` redi at gcc dot gnu.org
2021-06-04 17:17 ` redi at gcc dot gnu.org
2021-06-04 17:21 ` redi at gcc dot gnu.org
2021-06-04 17:21 ` redi at gcc dot gnu.org
2021-06-07 15:01 ` jakub at gcc dot gnu.org
2023-11-16 10:24 ` marc.mutz at hotmail dot com
2023-11-16 14:22 ` redi at gcc dot gnu.org
2023-11-16 14:35 ` redi at gcc dot gnu.org
2023-11-16 15:07 ` redi at gcc dot gnu.org [this message]
2023-11-16 16:35 ` terra at gnome dot org
2023-11-16 17:15 ` redi at gcc dot gnu.org
2023-11-21  0:30 ` headch at gmail dot com
2024-01-25 17:19 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100903-4-id9eHnso3D@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).