[Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
o_kniemeyer at maxon dot net
gcc-bugzilla@gcc.gnu.org
Fri Jun 14 13:48:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Ole Kniemeyer <o_kniemeyer at maxon dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |---
--- Comment #3 from Ole Kniemeyer <o_kniemeyer at maxon dot net> ---
In the example X can be converted to B which is a derived class of A. When an A
reference is initialized with an X object, the result of the X::operator B()
should be used directly for the A reference, but GCC creates a temporary A
object and initializes this by copy-construction from the conversion result.
At least if the classes use virtual functions, this leads to wrong results.
More information about the Gcc-bugs
mailing list