1// RUN: %check_clang_tidy -std=c++23-or-later %s readability-convert-member-functions-to-static %t
2
3namespace std{
4 class string {};
5 void println(const char *format, const std::string &str) {}
6}
7
8struct Hello {
9 std::string str_;
10
11 void ByValueSelf(this Hello self) { std::println(format: "Hello, {0}!", str: self.str_); }
12
13 void ByLRefSelf(this Hello &self) { std::println(format: "Hello, {0}!", str: self.str_); }
14
15 void ByRRefSelf(this Hello&& self) {}
16
17 template<typename Self> void ByForwardRefSelf(this Self&& self) {}
18
19 void MultiParam(this Hello &self, int a, double b) {}
20
21 void UnnamedExplicitObjectParam(this Hello &) {}
22};
23

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static-deducing-this.cpp