http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54293
Jiří Paleček <jpalecek at web dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jpalecek at web dot de --- Comment #4 from Jiří Paleček <jpalecek at web dot de> 2012-08-17 14:54:50 UTC --- Is that even a bug? In the standard (8.5.3/5), there is: — If the initializer expression — is an xvalue, *class prvalue*, array prvalue or function lvalue and “cv1 T1” is reference- compatible with “cv2 T2”, or — has a class type (i.e., T2 is a class type), where T1 is not reference-related to T2, and can be implicitly converted to an xvalue, class prvalue, or function lvalue of type “cv3 T3”, where “cv1 T1” is reference-compatible with “cv3 T3”, I don't think an rvalue of type int (which you have there as the initializer) is a class prvalue, so the initialization should proceed by the next stanza, ie. creating a temporary of type int thereby not extending the lifetime of ValueHolder temporary.