[PATCH] D153248: [clangd] Use resolveTypeToRecordDecl() to resolve the type of a base specifier during heuristic resolution

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 19 12:04:28 PDT 2023


nridge added a comment.

In D153248#4432108 <https://reviews.llvm.org/D153248#4432108>, @hokein wrote:

> The other question might worth thinking, are these cases critical to fix now? I'm not sure `this->find()` is a common case (`find();` already works today).

I may have simplified the test case a bit too much; a more representative case is one where the base class is a template, and the derived class passes its template parameter to the base:

  template <typename T>
  struct Waldo {
    void find();
  };
  
  template <typename T>
  using Wally = Waldo<T>;
  
  template <typename T>
  struct S : Wally<T> {
    void Foo() { this->find(); }
  };

In a case like, the base class is a "dependent base", and the `this->` is required (without it the code doesn't compile, because the compiler only attempts the first phase of the name lookup on `find`, and that gives no results).

In any case, the code was reduced from a bug report affecting a real codebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153248



More information about the cfe-commits mailing list