llvm-project/clang/test/Analysis/new.cpp

15 lines
277 B
C++
Raw Normal View History

2010-04-20 13:48:57 +08:00
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store region -verify %s
void f1() {
int *n = new int;
if (*n) { // expected-warning {{Branch condition evaluates to a garbage value}}
2010-04-20 13:48:57 +08:00
}
}
2010-04-20 13:48:57 +08:00
void f2() {
int *n = new int(3);
if (*n) { // no-warning
2010-04-20 13:48:57 +08:00
}
}