[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)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 14:39:17 PDT 2024


dyung wrote:

We are also seeing a build break internally which I bisected back to this change. In our case, I was able to reduce it to the following code:
```c++
#include <system_error>
template <typename a> class b {
  b operator=(b) { return operator=<>; }
  template <typename c, std::enable_if_t<std::is_convertible<c, a>::d>>
  void operator=(b);
};
```
After this change, this is now giving an error message:
```
repro:3:27: error: missing 'template' keyword prior to dependent template name 'operator='
    3 |   b operator=(b) { return operator=<>; }
      |                           ^        ~~
1 error generated.
```
This code compiles successfully with gcc 13.2, and if I apply the `-fdelayed-template-parsing` it also compiles, but I just wanted to make sure this change was expected, and if so, how should the code be fixed to be correct?

Godbolt link: https://godbolt.org/z/57br1s47z

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


More information about the cfe-commits mailing list