aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-tidy/modernize-avoid-c-arrays-ignores-main.cpp
blob: 6549422f393aaa9fe85a70e40cd31ec550b0556f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// RUN: %check_clang_tidy %s modernize-avoid-c-arrays %t

int not_main(int argc, char *argv[]) {
  // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not declare C-style arrays, use std::array<> instead
  int f4[] = {1, 2};
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead
}

int main(int argc, char *argv[]) {
  int f5[] = {1, 2};
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead

  auto not_main = [](int argc, char *argv[]) {
    // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: do not declare C-style arrays, use std::array<> instead
    int f6[] = {1, 2};
    // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use std::array<> instead
  };
}