1// RUN: %check_clang_tidy -std=c++20-or-later %s bugprone-forwarding-reference-overload %t
2
3template <typename T> constexpr bool just_true = true;
4
5class Test {
6public:
7 template <typename T> Test(T &&n);
8 // CHECK-NOTES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors
9
10 Test(const Test &rhs);
11 // CHECK-NOTES: :[[@LINE-1]]:3: note: copy constructor declared here
12};
13
14class Test1 {
15public:
16 // Guarded with requires expression.
17 template <typename T>
18 requires requires { just_true<T>; }
19 Test1(T &&n);
20};
21
22template<typename T>
23concept JustTrueConcept = requires { just_true<T>; };
24
25class Test2 {
26public:
27 // Guarded with concept requirement.
28 template <JustTrueConcept T> Test2(T &&n);
29};
30

source code of clang-tools-extra/test/clang-tidy/checkers/bugprone/forwarding-reference-overload-concepts.cpp