[PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects
Ben Craig via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 12 09:24:25 PST 2015
bcraig added a subscriber: bcraig.
bcraig added a comment.
I would love to see a test case with dynamic allocation. Something along the following...
struct Allocates {
int *x;
Allocates() : x(new int(0)) {}
Allocates(const Allocates &other) : x(new int(*other.x)) {}
};
... and then the flip side of that ...
struct OptionallyAllocates {
int *x;
OptionallyAllocates () : x(new int(0)) {}
OptionallyAllocates (const Allocates &other) {
// try / catch(...) would be fine here if std::nothrow is unappealing
x = new(std::nothrow) int(*other.x));
}
};
================
Comment at: test/clang-tidy/cert-throw-exception-type.cpp:1
@@ +1,2 @@
+// RUN: %check_clang_tidy %s cert-err60-cpp %t -- -- -std=c++11 -fcxx-exceptions
+
----------------
Doesn't this need an "| FileCheck %s"
http://reviews.llvm.org/D14619
More information about the cfe-commits
mailing list