diff options
Diffstat (limited to 'clang/test/Analysis')
-rw-r--r-- | clang/test/Analysis/cast-value-logic.cpp | 12 | ||||
-rw-r--r-- | clang/test/Analysis/cast-value-notes.cpp | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/clang/test/Analysis/cast-value-logic.cpp b/clang/test/Analysis/cast-value-logic.cpp index 531772825f9..221ae7f9ae3 100644 --- a/clang/test/Analysis/cast-value-logic.cpp +++ b/clang/test/Analysis/cast-value-logic.cpp @@ -19,7 +19,11 @@ struct Shape { virtual double area(); }; class Triangle : public Shape {}; -class Circle : public Shape {}; +class Circle : public Shape { +public: + ~Circle(); +}; +class SuspiciouslySpecificCircle : public Circle {}; } // namespace clang using namespace llvm; @@ -149,4 +153,10 @@ double test_virtual_method_after_call(Shape *S) { return S->area(); return S->area() / 2; } + +void test_delete_crash() { + extern Circle *makeCircle(); + Shape *S = makeCircle(); + delete cast<SuspiciouslySpecificCircle>(S); +} } // namespace crashes diff --git a/clang/test/Analysis/cast-value-notes.cpp b/clang/test/Analysis/cast-value-notes.cpp index f92ba90336a..a0eaeae8ba4 100644 --- a/clang/test/Analysis/cast-value-notes.cpp +++ b/clang/test/Analysis/cast-value-notes.cpp @@ -123,8 +123,7 @@ void evalZeroParamNonNullReturnPointer(const Shape *S) { void evalZeroParamNonNullReturn(const Shape &S) { const auto *C = S.castAs<Circle>(); - // expected-note@-1 {{'S' is a 'Circle'}} - // expected-note@-2 {{'C' initialized here}} + // expected-note@-1 {{'C' initialized here}} (void)(1 / !C); // expected-note@-1 {{'C' is non-null}} |