[clang] Reapply "[Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (#104458)" (PR #109422)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 10:00:02 PST 2025


sdkrystian wrote:

> This appears to cause incorrect behavior in the following code:
> 
> ```c++
> struct Pointee {
>     template<typename T>
>     T *method() { return nullptr; }
> };
> 
> template <typename T>
> struct Pointer {
>     T *pointer;
>     T *operator->() { return pointer; }
> };
> 
> struct Base {
>     Pointer<Pointee> field;
> };
> 
> template <typename T>
> struct Example: public Base {
>     bool example() {
>         return field->method<T>() == nullptr;
>     }
> };
> ```
> 
> The `field->method<T>()` is diagnosed as being a dependent template name and it doesn't appear to be one.

@porglezomp I just pushed a commit that should fix it.

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


More information about the cfe-commits mailing list