[Bug c++/36430] New: Cannot convert a temporary to a non-const reference even with conversion operator
gbrammer at gmx dot de
gcc-bugzilla@gcc.gnu.org
Tue Jun 3 18:39:00 GMT 2008
struct Foo {
operator Foo & () { return *this; }
};
void frobnicate(Foo &) {
/* in reality, the Foo is changed here and returned */
}
int main () {
frobnicate (Foo());
}
temporary.cpp:8: error: invalid initialization of non-const reference of type
ÂFoo&Â from a temporary of type ÂFooÂ
temporary.cpp:4: error: in passing argument 1 of Âvoid frobnicate(Foo&)Â
This works with g++ 4.1, but does not work with 4.2 and 4.3.
--
Summary: Cannot convert a temporary to a non-const reference even
with conversion operator
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gbrammer at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36430
More information about the Gcc-bugs
mailing list