[clang-tools-extra] r347860 - Adding a FIXME test to document an area for improvement with the cert-err58-cpp check; NFC.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 29 04:45:50 PST 2018
Author: aaronballman
Date: Thu Nov 29 04:45:50 2018
New Revision: 347860
URL: http://llvm.org/viewvc/llvm-project?rev=347860&view=rev
Log:
Adding a FIXME test to document an area for improvement with the cert-err58-cpp check; NFC.
Modified:
clang-tools-extra/trunk/test/clang-tidy/cert-static-object-exception.cpp
Modified: clang-tools-extra/trunk/test/clang-tidy/cert-static-object-exception.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/cert-static-object-exception.cpp?rev=347860&r1=347859&r2=347860&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/cert-static-object-exception.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/cert-static-object-exception.cpp Thu Nov 29 04:45:50 2018
@@ -260,4 +260,16 @@ auto Okay4 = []{ U u; return u.getBadLam
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
}
More information about the cfe-commits
mailing list