Assert that we aren't trying to push the same C++ temporary onto the live temporary stack twice. A little insurance against PR5867 surprising us again
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92132 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGTemporaries.cpp b/lib/CodeGen/CGTemporaries.cpp
index 8e214b4..bfce1b0 100644
--- a/lib/CodeGen/CGTemporaries.cpp
+++ b/lib/CodeGen/CGTemporaries.cpp
@@ -17,6 +17,9 @@
void CodeGenFunction::PushCXXTemporary(const CXXTemporary *Temporary,
llvm::Value *Ptr) {
+ assert((LiveTemporaries.empty() ||
+ LiveTemporaries.back().ThisPtr != Ptr) &&
+ "Pushed the same temporary twice; AST is likely wrong");
llvm::BasicBlock *DtorBlock = createBasicBlock("temp.dtor");
llvm::Value *CondPtr = 0;