| 1 | // RUN: %check_clang_tidy -std=c++14-or-later %s performance-unnecessary-value-param %t |
| 2 | |
| 3 | // The test case used to crash clang-tidy. |
| 4 | // https://github.com/llvm/llvm-project/issues/108963 |
| 5 | |
| 6 | struct A |
| 7 | { |
| 8 | template<typename T> A(T&&) {} |
| 9 | }; |
| 10 | |
| 11 | struct B |
| 12 | { |
| 13 | ~B(); |
| 14 | }; |
| 15 | |
| 16 | struct C |
| 17 | { |
| 18 | A a; |
| 19 | C(B, int i) : a(i) {} |
| 20 | // CHECK-MESSAGES: [[@LINE-1]]:6: warning: the parameter #1 is copied for each invocation but only used as a const reference; consider making it a const reference |
| 21 | }; |
| 22 | |
| 23 | C c(B(), 0); |
| 24 | |