r306799 - Fold exception-warnings.cpp into warn-throw-out-noexcept-func.cpp

Stephan Bergmann via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 30 00:22:02 PDT 2017


Author: sberg
Date: Fri Jun 30 00:22:02 2017
New Revision: 306799

URL: http://llvm.org/viewvc/llvm-project?rev=306799&view=rev
Log:
Fold exception-warnings.cpp into warn-throw-out-noexcept-func.cpp

I had failed to notice the latter existed when I recently introduced the former.

Removed:
    cfe/trunk/test/SemaCXX/exception-warnings.cpp
Modified:
    cfe/trunk/test/SemaCXX/warn-throw-out-noexcept-func.cpp

Removed: cfe/trunk/test/SemaCXX/exception-warnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/exception-warnings.cpp?rev=306798&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/exception-warnings.cpp (original)
+++ cfe/trunk/test/SemaCXX/exception-warnings.cpp (removed)
@@ -1,36 +0,0 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
-
-struct B {};
-struct D: B {};
-void goodPlain() throw () {
-  try {
-    throw D();
-  } catch (B) {}
-}
-void goodReference() throw () {
-  try {
-    throw D();
-  } catch (B &) {}
-}
-void goodPointer() throw () {
-  D d;
-  try {
-    throw &d;
-  } catch (B *) {}
-}
-void badPlain() throw () { // expected-note {{non-throwing function declare here}}
-  try {
-    throw B(); // expected-warning {{'badPlain' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
-  } catch (D) {}
-}
-void badReference() throw () { // expected-note {{non-throwing function declare here}}
-  try {
-    throw B(); // expected-warning {{'badReference' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
-  } catch (D &) {}
-}
-void badPointer() throw () { // expected-note {{non-throwing function declare here}}
-  B b;
-  try {
-    throw &b; // expected-warning {{'badPointer' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
-  } catch (D *) {}
-}

Modified: cfe/trunk/test/SemaCXX/warn-throw-out-noexcept-func.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-throw-out-noexcept-func.cpp?rev=306799&r1=306798&r2=306799&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-throw-out-noexcept-func.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-throw-out-noexcept-func.cpp Fri Jun 30 00:22:02 2017
@@ -253,6 +253,43 @@ void with_try_block1() noexcept try { //
 } catch (char *) {
 }
 
+namespace derived {
+struct B {};
+struct D: B {};
+void goodPlain() noexcept {
+  try {
+    throw D();
+  } catch (B) {}
+}
+void goodReference() noexcept {
+  try {
+    throw D();
+  } catch (B &) {}
+}
+void goodPointer() noexcept {
+  D d;
+  try {
+    throw &d;
+  } catch (B *) {}
+}
+void badPlain() noexcept { // expected-note {{non-throwing function declare here}}
+  try {
+    throw B(); // expected-warning {{'badPlain' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
+  } catch (D) {}
+}
+void badReference() noexcept { // expected-note {{non-throwing function declare here}}
+  try {
+    throw B(); // expected-warning {{'badReference' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
+  } catch (D &) {}
+}
+void badPointer() noexcept { // expected-note {{non-throwing function declare here}}
+  B b;
+  try {
+    throw &b; // expected-warning {{'badPointer' has a non-throwing exception specification but can still throw, resulting in unexpected program termination}}
+  } catch (D *) {}
+}
+}
+
 int main() {
   R1_ShouldDiag<int> o; //expected-note {{in instantiation of member function}}
   S1_ShouldDiag<int> b; //expected-note {{in instantiation of member function}}




More information about the cfe-commits mailing list