summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-06-30 07:22:02 +0000
committerStephan Bergmann <sbergman@redhat.com>2017-06-30 07:22:02 +0000
commit7428528cb416e30cb13bc08a28abe301c6cc9760 (patch)
treec6ebdf9aa71016953d7d49ecc932cf614e1b2b76
parentc39696441c150da6ed9eaebd6f03c7939555edbf (diff)
downloadbcm5719-llvm-7428528cb416e30cb13bc08a28abe301c6cc9760.tar.gz
bcm5719-llvm-7428528cb416e30cb13bc08a28abe301c6cc9760.zip
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. llvm-svn: 306799
-rw-r--r--clang/test/SemaCXX/exception-warnings.cpp36
-rw-r--r--clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp37
2 files changed, 37 insertions, 36 deletions
diff --git a/clang/test/SemaCXX/exception-warnings.cpp b/clang/test/SemaCXX/exception-warnings.cpp
deleted file mode 100644
index f6c646e5a40..00000000000
--- a/clang/test/SemaCXX/exception-warnings.cpp
+++ /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 *) {}
-}
diff --git a/clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp b/clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp
index dfd1ff9065a..fc2919a1e32 100644
--- a/clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp
+++ b/clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp
@@ -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}}
OpenPOWER on IntegriCloud