Index: include/clang/Analysis/CFG.h =================================================================== --- include/clang/Analysis/CFG.h +++ include/clang/Analysis/CFG.h @@ -182,7 +182,8 @@ /// Returns true when call expression \p CE needs to be represented /// by CFGCXXRecordTypedCall, as opposed to a regular CFGStmt. static bool isCXXRecordTypedCall(CallExpr *CE) { - return CE->getType().getCanonicalType()->getAsCXXRecordDecl(); + return !CE->isLValue() && + CE->getType().getCanonicalType()->getAsCXXRecordDecl(); } explicit CFGCXXRecordTypedCall(CallExpr *CE, Index: test/Analysis/temporaries.cpp =================================================================== --- test/Analysis/temporaries.cpp +++ test/Analysis/temporaries.cpp @@ -1032,4 +1032,17 @@ } } // end namespace implicit_constructor_conversion +namespace pass_references_through { +class C { +public: + ~C() {} +}; + +const C &foo(); +// In this example the foo() expression has record type, +// not reference type. But luckily it's still an lvalue. +// Don't try to figure out how to perform construction +// of the record here. +const C &bar() { return foo(); } // no-crash +} // end namespace pass_references_through