public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "m.cencora at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113219] Overloaded ref-qualified conversion operator triggers bogus -Wconversion Date: Thu, 04 Jan 2024 08:17:04 +0000 [thread overview] Message-ID: <bug-113219-4-aP3UYXaaj3@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113219-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113219 --- Comment #2 from m.cencora at gmail dot com --- So I guess this falls into the "confusing overload resolution for user-defined conversion" but I fail to see what can be confusing here. createInt() returns prvalue, so later it binds to xvalue for the purpose of implicit conversion operator invocation. That means that r-value qualified conversion operator is chosen. If your advice is to avoid using "-Wconversion" that it is rather unfortunate because user looses good warnings (e.g. about conversions that may alter the value). Also there is no way to silence the warning for such a code, since gcc warns on each call-site, not on definition-site of the overloads. So it either unfeasible or even impossible if the definitions are in library code, but warnings are enabled in user code. Please consider removing the warning generation in such scenarios.
prev parent reply other threads:[~2024-01-04 8:17 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-03 16:38 [Bug c++/113219] New: " m.cencora at gmail dot com 2024-01-03 21:58 ` [Bug c++/113219] " pinskia at gcc dot gnu.org 2024-01-04 8:17 ` m.cencora at gmail dot com [this message]
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-113219-4-aP3UYXaaj3@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: linkBe 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).