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++/101124] [12 Regression] pair<T*, int>(0, 0) was intended to be deprecated, but is rejected now Date: Tue, 18 Jan 2022 11:11:43 +0000 [thread overview] Message-ID: <bug-101124-4-tDVBGRbXUU@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101124-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101124 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Another example that now fails: #include <utility> struct X { } x; std::pair<const X, void*> p(x, 0); This selects the pair<T1,T2>::pair<U1,U2>(U1&&, U2&&) constructor, because x is non-const and the pair<T1,T2>::first_type type is const. U2 gets deduced as int, and int cannot convert to a pointer. This code is just wrong and the standard says it should not compile, it should be fixed to use p(x, nullptr). p(std::as_const(x), 0) would also work, but is gross. Just use nullptr.
next prev parent reply other threads:[~2022-01-18 11:11 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-18 13:33 [Bug libstdc++/101124] New: " redi at gcc dot gnu.org 2021-06-21 6:15 ` [Bug libstdc++/101124] " rguenth at gcc dot gnu.org 2021-09-25 20:08 ` redi at gcc dot gnu.org 2022-01-17 14:26 ` rguenth at gcc dot gnu.org 2022-01-18 11:11 ` redi at gcc dot gnu.org [this message] 2022-01-18 16:32 ` cvs-commit at gcc dot gnu.org 2022-01-18 16:37 ` 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-101124-4-tDVBGRbXUU@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).