JonasToth added inline comments.
================ Comment at: docs/clang-tidy/checks/misc-forwarding-reference-overload.rst:38 +constructors. We suppress warnings if the copy and the move constructors are both +disabled (deleted or private), because there is nothing the prefect forwarding +constructor could hide in this case. We also suppress warnings for constructors ---------------- typo: prefect -> perfect ================ Comment at: test/clang-tidy/misc-forwarding-reference-overload.cpp:21 + Person(T &&n); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: function 'Person' can hide copy and move constructors [misc-forwarding-reference-overload] + ---------------- leanil wrote: > JonasToth wrote: > > could the check output a note when there was a userdefined constructor and > > point to that one if it gets hidden? that would make it clearer, what and > > how the problem occurs. > What do you mean by "if it gets hidden"? Should I look for specific calls > that are hijacked by the perfect forwarding ctor? Or just make a note on the > user defined copy/move ctors any time I produce a warning (without looking at > actual calls)? > I think the former would be quite tricky to do. > Also, what if the perfect forwarding ctor hides the compiler generated > copy/move? Should I still make a note (maybe pointing to the class itself)? ``` class Person { public: // perfect forwarding ctor template<typename T> explicit Person(T&& n) {} // (possibly compiler generated) copy ctor Person(const Person& rhs); }; ``` a note pointing to a user defined ctor would be good i think. with compiler generated operations the warning is clear. emitting such a note would be a minor feature and if too complicated not worth it, i guess. Repository: rL LLVM https://reviews.llvm.org/D30547 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits