summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2018-11-29 12:45:50 +0000
committerAaron Ballman <aaron@aaronballman.com>2018-11-29 12:45:50 +0000
commit3e3696bf467debb19f413642c49c14df839a584a (patch)
tree6420a1986c6f025f2848be8c778351f01b10115d /clang-tools-extra/test
parentc1d3f71344bfb207f843ec569b025443a5785a45 (diff)
downloadbcm5719-llvm-3e3696bf467debb19f413642c49c14df839a584a.tar.gz
bcm5719-llvm-3e3696bf467debb19f413642c49c14df839a584a.zip
Adding a FIXME test to document an area for improvement with the cert-err58-cpp check; NFC.
llvm-svn: 347860
Diffstat (limited to 'clang-tools-extra/test')
-rw-r--r--clang-tools-extra/test/clang-tidy/cert-static-object-exception.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/cert-static-object-exception.cpp b/clang-tools-extra/test/clang-tidy/cert-static-object-exception.cpp
index 5c07c8d606a..b915252bfff 100644
--- a/clang-tools-extra/test/clang-tidy/cert-static-object-exception.cpp
+++ b/clang-tools-extra/test/clang-tidy/cert-static-object-exception.cpp
@@ -260,4 +260,16 @@ auto Okay4 = []{ U u; return u.getBadLambda(); }();
auto NotOkay3 = []() noexcept { U u; return u.getBadLambda(); }()(); // Because the lambda returned and called is not noexcept
// CHECK-EXCEPTIONS: :[[@LINE-1]]:6: warning: initialization of 'NotOkay3' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
// CHECK-EXCEPTIONS: :[[@LINE-6]]:12: note: possibly throwing function declared here
+
+#ifndef NONEXCEPTIONS
+struct Bad {
+ Bad() {
+ throw 12;
+ }
+};
+
+static auto NotOkay4 = [bad = Bad{}](){};
+// FIXME: the above should be diagnosed because the capture init can trigger
+// an exception when constructing the Bad object.
+#endif // NONEXCEPTIONS
}
OpenPOWER on IntegriCloud