if (IndirectGotoStmt *IGS = dyn_cast<IndirectGotoStmt>(Jump)) {
LabelDecl *Target = IGS->getConstantTarget();
CheckJump(IGS, Target->getStmt(), IGS->getGotoLoc(),
- diag::err_goto_into_protected_scope, 0);
+ diag::err_goto_into_protected_scope,
+ diag::warn_goto_into_protected_scope);
continue;
}
SmallVector<unsigned, 10> ToScopesError;
SmallVector<unsigned, 10> ToScopesWarning;
for (unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) {
- if (S.getLangOptions().Microsoft &&
+ if (S.getLangOptions().Microsoft && JumpDiagWarning != 0 &&
IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag))
ToScopesWarning.push_back(I);
else if (Scopes[I].InDiag)
}
-
-
-
-
-
-
-
-
namespace ms_protected_scope {
struct C { C(); };
} catch(int) {
}
}
+
+int jump_over_indirect_goto() {
+ static void *ps[] = { &&a0 };
+ goto *&&a0; // expected-warning {{goto into protected scope}}
+ int a = 3; // expected-note {{jump bypasses variable initialization}}
+ a0:
+ return 0;
+}
}
break;
}
}
+
+
+namespace test10 {
+\r
+int test() {\r
+ static void *ps[] = { &&a0 };\r
+ goto *&&a0; // expected-error {{goto into protected scope}}\r
+ int a = 3; // expected-note {{jump bypasses variable initialization}}\r
+ a0:\r
+ return 0;\r
+}
+
}
+
+}
+