[clang] [Clang] Fix name lookup for dependent bases (PR #114978)

Vladislav Belov via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 14:43:05 PST 2024


vbe-sc wrote:

Such an example causes a failure in my patch

```c++
template <class T> 
class X {
public:
  X() = default;
  virtual ~X() = default;

  virtual int foo(int x, int y, T &entry) = 0;

  void bar() {
    struct Processor : public X<T> {
      Processor() : X() {}

      int foo(int, int, T &) override {
        return 42;
      }
    };
  }
};
```

The output 
```
llvm-project/clang/lib/AST/DeclCXX.cpp:2508: void clang::CXXMethodDecl::addOverriddenMethod(const CXXMethodDecl *): Assertion `!MD->getParent()->isDependentContext() && "Can't add an overridden method to a class template!"' failed.
```

The problem case is class definition nested to the method. 
I'm working on investigation and fixing this issue  

https://github.com/llvm/llvm-project/pull/114978


More information about the cfe-commits mailing list