summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/cpp11-migrate/LoopConvert/negative-pseudoarray-extra.cpp
blob: 3ccdb12c62024db8b30ca28b6d8c01638d4767cd (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
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
// RUN: cpp11-migrate -loop-convert %t.cpp -- -I %S/Inputs
// RUN: FileCheck -input-file=%t.cpp %s

#include "structures.h"

// Single FileCheck line to make sure that no loops are converted.
// CHECK-NOT: for ({{.*[^:]:[^:].*}})

const int N = 6;
dependent<int> v;
dependent<int> *pv;

int sum = 0;

// Checks to see that non-const member functions are not called on the container
// object.
// These could be conceivably allowed with a lower required confidence level.
void memberFunctionCalled() {
  for (int i = 0; i < v.size(); ++i) {
    sum += v[i];
    v.foo();
  }

  for (int i = 0; i < v.size(); ++i) {
    sum += v[i];
    dependent<int>::iterator it = v.begin();
  }
}
OpenPOWER on IntegriCloud