1 | // RUN: %check_clang_tidy %s google-default-arguments %t |
2 | |
3 | struct A { |
4 | virtual void f(int I, int J = 3); |
5 | // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: default arguments on virtual or override methods are prohibited [google-default-arguments] |
6 | }; |
7 | |
8 | struct B : public A { |
9 | void f(int I, int J = 5); |
10 | // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: default arguments on virtual or override methods are prohibited |
11 | }; |
12 | |
13 | struct C : public B { |
14 | void f(int I, int J = 5) override; |
15 | // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: default arguments on virtual or override methods are prohibited |
16 | }; |
17 | |
18 | // Negatives. |
19 | struct D : public B { |
20 | void f(int I, int J) override; |
21 | }; |
22 | |
23 | struct X { |
24 | void f(int I, int J = 3); |
25 | }; |
26 | |
27 | struct Y : public X { |
28 | void f(int I, int J = 5); |
29 | }; |
30 | |