[PATCH] D114251: [AST] Add a sugar type for types found via UsingDecl

David Rector via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 16 07:20:25 PST 2021


davrec added a comment.

`throughUsingDecl` seems like a good solution, though I defer to regular ASTMatchers users.

One other thought: can we add diagnostic notes using this new information, e.g.

  struct A1 {
  protected:
    using IntType = char;
  };
  
  struct A2 {
  protected:
    using IntType = unsigned long;
  };
  
  struct B : A1, A2 {
    using A1::IntType;
  };
  
  struct C : B {
    IntType foo;
    void setFoo(IntType V) {
      foo = V;
    }
  };
  
  
  int main() {
    D d;
    d.setFoo((unsigned long)-1); // warning: implicit conversion loses info 
  }

It would be nice to add a note pointing to `using A1::IntType` saying "introduced here".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114251



More information about the cfe-commits mailing list