blob: 6b962157da73840c321d6e5c7bbce22ea49b10c1 [file] [log] [blame]
Ted Kremenek565e4652010-02-05 02:06:54 +00001// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
Zhongxing Xubc37b8d2010-01-09 09:16:47 +00002
3void f1() {
4 int const &i = 3;
5 int b = i;
Zhongxing Xu3cd8bd42010-01-10 02:52:56 +00006
7 int *p = 0;
8
9 if (b != 3)
10 *p = 1; // no-warning
Zhongxing Xubc37b8d2010-01-09 09:16:47 +000011}
Zhongxing Xufc61d942010-06-03 06:23:18 +000012
13char* ptr();
14char& ref();
15
16// These next two tests just shouldn't crash.
17char t1 () {
18 ref() = 'c';
19 return '0';
20}
21
22// just a sanity test, the same behavior as t1()
23char t2 () {
24 *ptr() = 'c';
25 return '0';
26}