• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %check_clang_tidy %s modernize-avoid-c-arrays %t
2 
not_main(int argc,char * argv[],char * argw[])3 int not_main(int argc, char *argv[], char *argw[]) {
4   // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not declare C-style arrays, use std::array<> instead
5   // CHECK-MESSAGES: :[[@LINE-2]]:38: warning: do not declare C-style arrays, use std::array<> instead
6   int f4[] = {1, 2};
7   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead
8 }
9 
main(int argc,char * argv[],char * argw[])10 int main(int argc, char *argv[], char *argw[]) {
11   int f5[] = {1, 2};
12   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead
13 
14   auto not_main = [](int argc, char *argv[], char *argw[]) {
15     // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: do not declare C-style arrays, use std::array<> instead
16     // CHECK-MESSAGES: :[[@LINE-2]]:46: warning: do not declare C-style arrays, use std::array<> instead
17     int f6[] = {1, 2};
18     // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use std::array<> instead
19   };
20 }
21