23 lines · cpp
1// RUN: %check_clang_tidy -std=c++17 %s modernize-avoid-c-arrays %t2 3namespace X {4// Not main5int main(int argc, char *argv[]) {6 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead7 int f4[] = {1, 2};8 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead9 return 0;10}11}12 13int main(int argc, char *argv[]) {14 int f5[] = {1, 2};15 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead16 17 auto not_main = [](int argc, char *argv[]) {18 // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead19 int f6[] = {1, 2};20 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use 'std::array' instead21 };22}23