1 | // RUN: %check_clang_tidy -std=c++17 %s modernize-avoid-c-arrays %t |
---|---|
2 | |
3 | namespace X { |
4 | // Not main |
5 | int main(int argc, char *argv[]) { |
6 | // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead |
7 | int f4[] = {1, 2}; |
8 | // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead |
9 | return 0; |
10 | } |
11 | } |
12 | |
13 | int 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' instead |
16 | |
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' instead |
19 | int f6[] = {1, 2}; |
20 | // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use 'std::array' instead |
21 | }; |
22 | } |
23 |