[PATCH] D72498: [clangd] Print underlying type for decltypes in hover

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 12 20:30:30 PST 2020


ilya-biryukov added a comment.

In D72498#1814366 <https://reviews.llvm.org/D72498#1814366>, @sammccall wrote:

> @ilya-biryukov @kadircet what do you think about unwrapping decltype only when it's a return value (optional: of a function whose leading return type is auto) to narrowly catch this idiom?


If we feel it's useful in the function return type, it's probably also useful in other template contexts:
E.g.

  template <class T>
  struct X {
    typedef decltype(T() + T()) add_result_type;
  };
  
  X<int>::^add_result_type y;

And I don't think it's used in practice in more contexts.

Moreover, I believe usages in function returns will become more rare as projects move to C++14 and beyond (`auto` return type gives the same results in most interesting cases without code duplication).

Therefore, I'd not special-case for function return types.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72498





More information about the cfe-commits mailing list