[clang] [Clang][Sema] Fix lookup of dependent operator= outside of complete-class contexts (PR #91498)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 03:58:43 PDT 2024


sdkrystian wrote:

@glandium I've reduced it to the following:
```cpp
template<typename T>
struct A
{
    static constexpr bool B = true;
};

template<bool V>
struct C { };

template<typename T>
struct D
{
    C<A<T>::B> f();
};

template<typename T>
auto D<T>::f() -> C<A<T>::B> { }
```
The problem is that we build a `DependentScopeDeclRefExpr` for `A<T>::B` in the first declaration of `f`, and a `CXXDependentScopeMemberExpr` for the second declaration of `f`. 

Since we have no idea whether `A<T>::B` will be an implicit member access, I think that the correct behavior is that `ActOnDependentIdExpression` should _never_ build a `CXXDependentScopeMemberExpr`.

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


More information about the cfe-commits mailing list