blob: b5746d1fe767e1599e0610299aaaa8bc5c8f7b4b [file] [log] [blame]
Matthew Vosse4b01442018-06-12 22:22:35 +00001// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-max-loop 4 -analyzer-config widen-loops=true -verify %s
2
3void clang_analyzer_eval(int);
4
5struct A {
6 ~A() {}
7};
8struct B : public A {};
9
10void invalid_type_region_access() {
11 const A &x = B();
12 for (int i = 0; i < 10; ++i) { }
13 clang_analyzer_eval(&x != 0); // expected-warning{{TRUE}}
14} // expected-warning@-1{{reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to true}}