Add -Wc++98-compat diagnostics for jumps which bypass initialization of non-POD
but trivially constructible and destructible variables in C++11 mode. Also
incidentally improve the precision of the wording for jump diagnostics in C++98
mode.

llvm-svn: 142619
diff --git a/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp b/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
index 18fd340..f52e3b6 100644
--- a/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
+++ b/clang/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
@@ -30,7 +30,7 @@
 
 void test_Y() {
   goto end; // expected-error{{goto into protected scope}}
-  Y y; // expected-note{{jump bypasses variable initialization}}
+  Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
  end:
   return;
 }
@@ -41,7 +41,7 @@
 
 void test_Z() {
   goto end; // expected-error{{goto into protected scope}}
-  Z z; // expected-note{{jump bypasses variable initialization}}
+  Z z; // expected-note{{jump bypasses initialization of non-POD variable}}
  end:
   return;
 }
diff --git a/clang/test/SemaCXX/MicrosoftCompatibility.cpp b/clang/test/SemaCXX/MicrosoftCompatibility.cpp
index dfc47d6..1dadfec 100644
--- a/clang/test/SemaCXX/MicrosoftCompatibility.cpp
+++ b/clang/test/SemaCXX/MicrosoftCompatibility.cpp
@@ -35,7 +35,7 @@
 
 void jump_over_var_with_dtor() {
   goto end; // expected-warning{{goto into protected scope}}
-  Y y; // expected-note {{jump bypasses variable initialization}}
+  Y y; // expected-note {{jump bypasses variable with a non-trivial destructor}}
  end:
     ;
 }
@@ -155,4 +155,4 @@
 

 template class B<int>;

 

-}
\ No newline at end of file
+}
diff --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp
index 260e86b..051176b 100644
--- a/clang/test/SemaCXX/cxx98-compat.cpp
+++ b/clang/test/SemaCXX/cxx98-compat.cpp
@@ -243,3 +243,20 @@
   int k = T::enum_val; // expected-warning {{enumeration type in nested name specifier is incompatible with C++98}}
 };
 template void EnumNNSFn<Enum>(); // expected-note {{in instantiation}}
+
+void JumpDiagnostics(int n) {
+  goto DirectJump; // expected-warning {{goto would jump into protected scope in C++98}}
+  TrivialButNonPOD tnp1; // expected-note {{jump bypasses initialization of non-POD variable}}
+
+DirectJump:
+  void *Table[] = {&&DirectJump, &&Later};
+  goto *Table[n]; // expected-warning {{indirect goto might cross protected scopes in C++98}}
+
+  TrivialButNonPOD tnp2; // expected-note {{jump bypasses initialization of non-POD variable}}
+Later: // expected-note {{possible target of indirect goto}}
+  switch (n) {
+    TrivialButNonPOD tnp3; // expected-note {{jump bypasses initialization of non-POD variable}}
+  default: // expected-warning {{switch case would be in a protected scope in C++98}}
+    return;
+  }
+}