Lifetime extension for reference-initializing temporaries


I can't find the code that extends the lifetime of temporaries that are bound to references. Can someone please help me out?


Look for CXXBindTemporaryExpr.


It's actually implicit in the AST. IR generation deals with this via CGExpr.cpp's EmitExprForReferenceBinding, in particular, where we dig out the destructor for the temporary (which going into the variable ReferenceTemporaryDtor) after digging through all of the subobject adjustments that may have been applied to the temporary as part of reference binding.

  - Doug