summaryrefslogtreecommitdiffstats
path: root/tools/clang-tidy/test/performance-for-range-copy.cpp
blob: 264dd42896e307fe78dce9f2438f6490a563f84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
template <typename T>
struct Iterator {
  void operator++() {}
  const T& operator*() {
    static T* TT = new T();
    return *TT;
  }
  bool operator!=(const Iterator &) { return false; }
  typedef const T& const_reference;
};
template <typename T>
struct View {
  T begin() { return T(); }
  T begin() const { return T(); }
  T end() { return T(); }
  T end() const { return T(); }
  typedef typename T::const_reference const_reference;
};

struct S {
  S();
  S(const S &);
  ~S();
  S &operator=(const S &);
};

void negativeConstReference() {
  for (const S S1 : View<Iterator<S>>()) {
  }
}