Index: clang/lib/AST/Interp/EvalEmitter.cpp =================================================================== --- clang/lib/AST/Interp/EvalEmitter.cpp +++ clang/lib/AST/Interp/EvalEmitter.cpp @@ -253,7 +253,12 @@ for (auto &Local : Descriptors[I]) { auto It = Locals.find(Local.Offset); assert(It != Locals.end() && "Missing local variable"); - S.deallocate(reinterpret_cast(It->second.get())); + Block *B = reinterpret_cast(It->second.get()); + S.deallocate(B); + // Just make sure we're runnnig into some kind of error when a + // local variable is used after being destroyed. + InlineDescriptor &ID = *reinterpret_cast(B->rawData()); + std::memset(&ID, 0, sizeof(InlineDescriptor)); } return true; Index: clang/lib/AST/Interp/InterpFrame.cpp =================================================================== --- clang/lib/AST/Interp/InterpFrame.cpp +++ clang/lib/AST/Interp/InterpFrame.cpp @@ -75,6 +75,10 @@ void InterpFrame::destroy(unsigned Idx) { for (auto &Local : Func->getScope(Idx).locals()) { S.deallocate(reinterpret_cast(localBlock(Local.Offset))); + // Just make sure we're runnnig into some kind of error when a + // local variable is used after being destroyed. + InlineDescriptor *ID = localInlineDesc(Local.Offset); + std::memset(ID, 0, sizeof(InlineDescriptor)); } }