1 | // RUN: %check_clang_tidy %s fuchsia-default-arguments-calls %t |
2 | |
3 | int foo(int value = 5) { return value; } |
4 | |
5 | int f() { |
6 | foo(); |
7 | // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls] |
8 | // CHECK-NOTES: [[@LINE-5]]:9: note: default parameter was declared here |
9 | } |
10 | |
11 | int bar(int value) { return value; } |
12 | |
13 | int n() { |
14 | foo(value: 0); |
15 | bar(value: 0); |
16 | } |
17 | |
18 | void x(int i = 12); |
19 | |
20 | struct S { |
21 | void x(int i); |
22 | }; |
23 | |
24 | void S::x(int i = 12) {} |
25 | |
26 | int main() { |
27 | S s; |
28 | s.x(); |
29 | // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls] |
30 | // CHECK-NOTES: [[@LINE-6]]:11: note: default parameter was declared here |
31 | // CHECK-NEXT: void S::x(int i = 12) {} |
32 | x(); |
33 | // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls] |
34 | // CHECK-NOTES: [[@LINE-16]]:8: note: default parameter was declared here |
35 | // CHECK-NEXT: void x(int i = 12); |
36 | } |
37 | |