[PATCH] D142630: [clang][Interp] Implement virtual function calls

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 7 10:43:53 PST 2023


tbaeder added a comment.

Hmm, this doesn't work if the callee is somewhere in between the path from the dynamic to the static type, e.g.

  struct A {
    virtual constexpr int foo() const { return 1; }
  };
  
  struct B : A {
    virtual constexpr int foo() const { return A::foo(); }
  };
  
  constexpr B a;
  static_assert(a.foo() == 1);

For the `A::foo()` call, the type of the `This` pointer is `B`, so we will just select the `B::foo()` to call.


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

https://reviews.llvm.org/D142630



More information about the cfe-commits mailing list