| 1 | // RUN: %check_clang_tidy %s modernize-redundant-void-arg %t -- -- -fdelayed-template-parsing |
| 2 | |
| 3 | int foo(void) { |
| 4 | // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: redundant void argument list in function definition [modernize-redundant-void-arg] |
| 5 | // CHECK-FIXES: {{^}}int foo() {{{$}} |
| 6 | return 0; |
| 7 | } |
| 8 | |
| 9 | template <class T> |
| 10 | struct MyFoo { |
| 11 | int foo(void) { |
| 12 | // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: redundant void argument list in function definition [modernize-redundant-void-arg] |
| 13 | // CHECK-FIXES: {{^}} int foo() {{{$}} |
| 14 | return 0; |
| 15 | } |
| 16 | }; |
| 17 | // Explicit instantiation. |
| 18 | template class MyFoo<int>; |
| 19 | |
| 20 | template <class T> |
| 21 | struct MyBar { |
| 22 | // This declaration isn't instantiated and won't be parsed 'delayed-template-parsing'. |
| 23 | int foo(void) { |
| 24 | // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: redundant void argument list in function definition [modernize-redundant-void-arg] |
| 25 | // CHECK-FIXES: {{^}} int foo() {{{$}} |
| 26 | return 0; |
| 27 | } |
| 28 | }; |
| 29 | |