mgehre marked 2 inline comments as done.
mgehre added inline comments.

================
Comment at: 
clang-tools-extra/test/clang-tidy/readability-static-const-method.cpp:209
+void KeepLambdas() {
+  auto F = +[]() { return 0; };
+  auto F2 = []() { return 0; };
----------------
JonasToth wrote:
> Does it pass here?
> I looks a bit weird, shouldnt the lambda be called for this to work (this is 
> the unary + right?)?
https://stackoverflow.com/questions/18889028/a-positive-lambda-what-sorcery-is-this


================
Comment at: 
clang-tools-extra/test/clang-tidy/readability-static-const-method.cpp:312
+    return const_cast<DataPattern *>(this)->get();
+  }
+
----------------
JonasToth wrote:
> I think more template tests wouldn't hurt. From the other checks experience I 
> can safely say we got burned a few times :)
> Instantiating the templates with builtin arrays, pointers, references and 
> different qualifiers usually produces interesting test cases as well, that 
> need to be handled properly.
> 
> Another thing that comes to mind with templates are overloaded operators.
> ```
> template <class Foo>
> void bar() {
>      Foo x1, x2;
>      Foo y = x1 + x2;
> }
> ```
> Builtins are not changed by `operator+` but that can not be said about other 
> types in general (maybe with concepts used properly).
The check only checks templates instantiations (so we will see no template 
parameters, just ordinary types). The plus here will be be function call in the 
AST of the instantiation when Foo has an overloaded operator+.
The current version will never propose to make bar() const when a method on 
`this` is called.
I can add the test to show this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61749/new/

https://reviews.llvm.org/D61749



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to