Quuxplusone added a comment.

In D113898#3140320 <https://reviews.llvm.org/D113898#3140320>, @kuhnel wrote:

> When trying to revert some of the changes, I just noticed there are a couple 
> of `if (const auto* ...` in `CodeComplete.cpp` and `AST.cpp` (and maybe other 
> files as well). So some folks seem to be using this right now. If we want to 
> be consistent, we would have to remove these `const` as well.

Just in case it's news to anyone: (1) Theoretically, the compiler has enough 
information to tell you when it's deducing a cv-qualified type for a 
non-forwarding-reference `auto`; and personally I'd like such a warning and 
would go fix my code every time it fired. I like that `const auto *p` has the 
same "shape" as `const Widget *p`. That sometimes a non-const `auto` can 
secretly mean //`const`//`Widget` is //weird// and I don't like it.
(2) In template contexts, `const auto *` can be significant, because maybe in 
some instantiations the `const` doesn't matter and in others it does. 
https://quuxplusone.github.io/blog/2020/03/04/field-report-on-lifetime-extension/#true-positive-3-conditionally-redundant-lifetime-extension-in-template-code
 is related.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113898

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

Reply via email to