diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -1837,6 +1837,11 @@ // this sequence up and replay them in reverse order when appending onto the // CFGBlock(s). SmallVector Decls; + + // Handles the case where goto skips initialization, but there is a destructor to the object. + if (B == LocalScope::const_iterator()) + return; + Decls.reserve(B.distance(E)); for (LocalScope::const_iterator I = B; I != E; ++I) Decls.push_back(*I);