[PATCH] D117463: [clangd] Disable expand-auto action on constrained auto.

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 23 18:35:13 PST 2022

nridge added a comment.

In D117463#3247915 <https://reviews.llvm.org/D117463#3247915>, @sammccall wrote:

> My intuition is that constrained auto is unlikely to be used in deducible contexts, but maybe some people will like `Iterator<int> auto I = foo.begin()` or so...

I expect this to be fairly common. For example, if you look at a recent standards proposal like `std::execution` which assumes C++20 as a baseline, and look at an end-user code example like this one <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2300r3.html#example-hello-world>, it uses things like `schedule auto x = ...` and `sender auto y = ...` pretty liberally.

I don't have a strong opinion on the policy question of whether replacing a constrained auto type with a concrete type is likely to be a useful refactoring. The use case of "I want the type name to be more descriptive" is less compelling since the concept name often provides an appropriate amount of description. But there may still be cases where the concrete type is important and preferable to use.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list