[clang] Reapply "[Clang][Sema] Fix crash when 'this' is used in a dependent class scope function template specialization that instantiates to a static member function (#87541)" (PR #88311)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 12 13:52:05 PDT 2024


sdkrystian wrote:

@rupprecht looks like the issue is with non-static members in base classes:
```cpp
struct B
{
    int z;
    void h(int);
};

template<typename T> 
struct A : B
{
    int y;
    void g(int);

    template<typename U>
    void f(U); 

    template<>
    void f(int x)
    {
        x;
        y;
        z; // error: reference to overloaded function could not be resolved
        g(x);
        g(y);
        g(z);
        g(0);
        h(x); // error: call to non-static member function without an object argument
        h(y);
        h(z); // error: no matching function for call to 'h'
        h(0); // error: call to non-static member function without an object argument
    }
};

template struct A<int>; 
```
I'll look into this and see whether it's a trivial fix. If not, I'll revert.

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


More information about the cfe-commits mailing list