brintos

brintos / llvm-project-archived public Read only

0
0
Text · 764 B · 146fc30 Raw
30 lines · cpp
1// RUN: %check_clang_tidy -std=c++20-or-later %s bugprone-forwarding-reference-overload %t2 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 constructors9 10  Test(const Test &rhs);11  // CHECK-NOTES: :[[@LINE-1]]:3: note: copy constructor declared here12};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