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: unassig...@gcc.gnu.org ReportedBy: r...@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