]> granicus.if.org Git - clang/commitdiff
Fold exception-warnings.cpp into warn-throw-out-noexcept-func.cpp
authorStephan Bergmann <sbergman@redhat.com>
Fri, 30 Jun 2017 07:22:02 +0000 (07:22 +0000)
committerStephan Bergmann <sbergman@redhat.com>
Fri, 30 Jun 2017 07:22:02 +0000 (07:22 +0000)
I had failed to notice the latter existed when I recently introduced the former.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306799 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaCXX/exception-warnings.cpp [deleted file]
test/SemaCXX/warn-throw-out-noexcept-func.cpp

diff --git a/test/SemaCXX/exception-warnings.cpp b/test/SemaCXX/exception-warnings.cpp
deleted file mode 100644 (file)
index f6c646e..0000000
+++ /dev/null
@@ -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 *) {}
-}
index dfd1ff9065ab9b50efa24b5c3cd48847c6a87a9b..fc2919a1e327a6f593cbae8ae87788408097816d 100644 (file)
@@ -253,6 +253,43 @@ void with_try_block1() noexcept try { //expected-note {{non-throwing function de
 } 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}}