Labels (and case statement) don't create independent scope parents for the
purposes of the jump checker.  Also extend Ted's iteration fix to labels.

Fixes PR7789.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110082 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/scope-check.cpp b/test/SemaCXX/scope-check.cpp
index dd70d97..cdc3868 100644
--- a/test/SemaCXX/scope-check.cpp
+++ b/test/SemaCXX/scope-check.cpp
@@ -133,3 +133,21 @@
     return;
   }
 }
+
+// PR7789
+namespace test8 {
+  void test1(int c) {
+    switch (c) {
+    case 0:
+      int x = 56; // expected-note {{jump bypasses variable initialization}}
+    case 1:       // expected-error {{switch case is in protected scope}}
+      x = 10;
+    }
+  }
+
+  void test2() {
+    goto l2;     // expected-error {{goto into protected scope}}
+  l1: int x = 5; // expected-note {{jump bypasses variable initialization}}
+  l2: x++;
+  }
+}