Make sure a variable with a C++ direct initializer triggers jump scope checking. Fixes PR10620 / <rdar://problem/9958362> .
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150204 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 8ba84fe..ec92470 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -16,6 +16,7 @@
#include "clang/Sema/Scope.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
+#include "clang/Sema/ScopeInfo.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
@@ -9223,6 +9224,9 @@
return;
}
+ if (VDecl->hasLocalStorage())
+ getCurFunction()->setHasBranchProtectedScope();
+
bool IsDependent = false;
for (unsigned I = 0, N = Exprs.size(); I != N; ++I) {
if (DiagnoseUnexpandedParameterPack(Exprs.get()[I], UPPC_Expression)) {