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 c++/51066] New: [C++0x] warning about binding an rvalue-reference to an implicit conversion result Date: Wed, 09 Nov 2011 18:14:00 -0000 [thread overview] Message-ID: <bug-51066-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51066 Bug #: 51066 Summary: [C++0x] warning about binding an rvalue-reference to an implicit conversion result Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: diagnostic Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: redi@gcc.gnu.org Inspired by the thread beginning with c++std-core-20672, G++ should warn about this code: struct A { }; struct B { B(A) {} }; A a; B&& b = a; warning: 'b' will bind to a temporary of type 'B' created by implicit conversion from 'a' This should only give a warning for a local variable of rvalue reference type that is initialized by a non-reference-related object so that an implicit conversion occurs. There should be no warning when the conversion initializes a function parameter e.g. void f(B&&); A a; f(a); // ok
next reply other threads:[~2011-11-09 17:59 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-11-09 18:14 redi at gcc dot gnu.org [this message] 2012-01-19 20:16 ` [Bug c++/51066] " redi at gcc dot gnu.org 2021-03-23 11:28 ` redi at gcc dot gnu.org 2021-03-23 11:51 ` redi at gcc dot gnu.org 2023-07-02 0:05 ` egallager 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-51066-4@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).