public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sshannin at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/96269] optional comparison with nullopt fails
Date: Tue, 21 Jul 2020 16:17:43 +0000 [thread overview]
Message-ID: <bug-96269-4-SChPa1TCGj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96269-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269
--- Comment #2 from sshannin at gmail dot com ---
(In reply to Jonathan Wakely from comment #1)
> Your operator== should be const-qualified.
I don't disagree. I can also fully remove the operator== and it compiles as
well (why should the presence of the non-const operator== cause the comparison
with nullopt in one direction to instantiate it).
But yeah, I lost something in my reduction in there. I think the main point is
that one direction of the comparison instantiates the templated operator== and
the other doesn't.
Consider this version of X instead, which avoids the const issues:
struct X {
int y;
template <typename T>
bool operator==(const T&o) const {
return y == o.summary();
}
};
We again end up instantiating X's operator== (even though we wouldn't call it)
in the FLIP case (and thus fail to compile), but in the non-flip case
everything seems fine.
next prev parent reply other threads:[~2020-07-21 16:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 14:44 [Bug libstdc++/96269] New: " sshannin at gmail dot com
2020-07-21 15:10 ` [Bug libstdc++/96269] " redi at gcc dot gnu.org
2020-07-21 16:17 ` sshannin at gmail dot com [this message]
2020-11-05 15:40 ` redi at gcc dot gnu.org
2020-11-05 15:52 ` ville.voutilainen at gmail dot com
2020-11-05 16:07 ` ville.voutilainen at gmail dot com
2020-11-05 16:51 ` sshannin at gmail dot com
2020-11-05 17:41 ` redi at gcc dot gnu.org
2020-11-05 17:50 ` redi at gcc dot gnu.org
2020-11-05 17:54 ` ville.voutilainen at gmail dot com
2020-11-05 18:00 ` [Bug libstdc++/96269] [10/11 Regression] " redi at gcc dot gnu.org
2020-11-05 19:09 ` cvs-commit at gcc dot gnu.org
2020-11-05 19:31 ` redi at gcc dot gnu.org
2020-11-05 19:38 ` 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-96269-4-SChPa1TCGj@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).