1 // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core -analyzer-output=plist-multi-file -o %t.plist -verify -analyzer-config eagerly-assume=false %s
2 // RUN: %normalize_plist <%t.plist | diff -ub %S/Inputs/expected-plists/cxx-for-range.cpp.plist -
12 *(volatile int *)0 = 1; // expected-warning {{Dereference of null pointer}}
18 *(volatile int *)0 = 1; // no-warning
25 using iterator
= int *;
27 iterator
begin() const;
31 MagicVector
get(bool fail
= false) {
33 *(volatile int *)0 = 1; // expected-warning {{Dereference of null pointer}}
37 void testLoopOpaqueCollection() {
42 *(volatile int *)0 = 1; // expected-warning {{Dereference of null pointer}}
48 *(volatile int *)0 = 1; // expected-warning {{Dereference of null pointer}}
58 int operator*() const;
59 iterator
&operator++();
60 bool operator==(const iterator
&);
61 bool operator!=(const iterator
&);
64 iterator
begin() const;
69 return MagicVector2
{};
72 void testLoopOpaqueIterator() {
73 for (int y
: get2()) {
77 *(volatile int *)0 = 1; // expected-warning {{Dereference of null pointer}}
83 *(volatile int *)0 = 1; // expected-warning {{Dereference of null pointer}}
87 void testLoopErrorInRange() {
88 for (int y
: get(true)) { // error inside get()
92 *(volatile int *)0 = 1; // no-warning
98 *(volatile int *)0 = 1; // no-warning
101 void testForRangeInit() {
102 for (int *arr
[3] = {nullptr, nullptr, nullptr}; int *p
: arr
) // expected-warning {{extension}}
103 *p
= 1; // expected-warning {{Dereference of null pointer}}