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
6struct A
7{
8 template<typename T> A(T&&) {}
9};
10
11struct B
12{
13 ~B();
14};
15
16struct 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
23C c(B(), 0);
24

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-crash.cpp