summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-bounds-constant-array-index-c++03.cpp
blob: ad1cc5ab897d94d16104311dbaeb1307595f008b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// RUN: %check_clang_tidy -std=c++98-or-later %s cppcoreguidelines-pro-bounds-constant-array-index %t

// Note: this test expects no diagnostics, but FileCheck cannot handle that,
// hence the use of | count 0.
template <int index> struct B {
  int get() {
    // The next line used to crash the check (in C++03 mode only).
    return x[index];
    // CHECK-FIXES: return x[index];
  }
  int x[3];
};
OpenPOWER on IntegriCloud