[clang] [clang-tools-extra] Reapply "[Clang][Sema] Diagnose class member access expressions naming non-existent members of the current instantiation prior to instantiation in the absence of dependent base classes (#84050)" (PR #90152)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 15:11:56 PDT 2024


yxsamliu wrote:

This patch seems to cause a regression for rocThrust:

https://github.com/ROCm/rocThrust/blob/f3a28e43355b0f439fb99a2210bd497ca59c8003/thrust/optional.h#L2756

rocThrust/thrust/../thrust/optional.h:2756:11: error: no member named 'construct' in 'optional<type-parameter-0-0 &>'

A reduced test case is

```
template<typename T>
struct A {
    T* m_value;

    void foo() {
        this->doit();
    }

    T *operator->() { return m_value; }
};

```
https://godbolt.org/z/eo5f3Wdv5

It seems clang does not account for the situation that the arrow operator may be overloaded to return an pointer to a template parameter type whose members are unknown.

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


More information about the cfe-commits mailing list