Does “T const&t = C().a;” lengthen the lifetime of “a”?
问题 The following scenario is given, to be interpreted as C++0x code: struct B { }; struct A { B b; }; int main() { B const& b = A().b; /* is the object still alive here? */ } Clang and GCC (trunk version as of 2011/02) behave differently: Clang lengthens the lifetime. GCC moves B to a new temporary object, and then binds the reference to that new temporary. I cannot find either behavior can be derived from the words of the Standard. The expression A().b is not a temporary (see 5.2.5). Can anyone