blob: c9775df7e2d06abfd026422b0f5b70019902b067 [file] [log] [blame]
Argyrios Kyrtzidisf4699d12011-02-18 20:55:19 +00001// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -verify %s
2
3int f1(char *dst) {
4 char *p = dst + 4;
5 char *q = dst + 3;
6 return !(q >= p);
7}
Argyrios Kyrtzidis4f20de12011-02-18 21:24:56 +00008
Argyrios Kyrtzidis7ff07dc2011-02-19 01:08:41 +00009long f2(char *c) {
10 return long(c) & 1;
11}
12
Argyrios Kyrtzidis370e6e92011-02-19 01:59:41 +000013bool f3() {
14 return !false;
15}
16
Argyrios Kyrtzidisb14175a2011-02-19 08:03:18 +000017void *f4(int* w) {
18 return reinterpret_cast<void*&>(w);
19}
20
Argyrios Kyrtzidis4f20de12011-02-18 21:24:56 +000021namespace {
22
23struct A { };
24struct B {
John McCall15e310a2011-02-19 02:53:41 +000025 operator A() { return A(); }
Argyrios Kyrtzidis4f20de12011-02-18 21:24:56 +000026};
27
28A f(char *dst) {
29 B b;
30 return b;
31}
32
33}
Argyrios Kyrtzidisb14175a2011-02-19 08:03:18 +000034
35namespace {
36
37struct S {
38 void *p;
39};
40
41void *f(S* w) {
42 return &reinterpret_cast<void*&>(*w);
43}
44
45}