[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)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri May 3 09:48:39 PDT 2024
erichkeane wrote:
> This seems to break the version of libstdc++ we use in our sysroot: (Details on https://crbug.com/338536261)
>
> ```
> ../../build/linux/debian_bullseye_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:1718:20: error: use 'template' keyword to treat 'operator =' as a dependent template name
> 1718 | return this->operator=<_It, _Sent>(__x);
> | ^
> 1 error generated.
> ```
>
> Is that expected, and if so do you have any suggestions for how to work around it?
Ooof, that one hurts and is likely something we have to do something about. I tracked down thefix to this commit: https://github.com/gcc-mirror/gcc/commit/56c999860bbbb2fd5091ba0985e2e5eaa90c6478
It wasn't done intentionally as far as I can tell (just that it was a rewrite/refactor?). So it looks like this was broken back through 2022, so only fixed as of 2 years ago.
This IS expected (in that the thing it is diagnosing is broken code AFAICT). The workaround is you can add the `template` keyword I believe. That said, as this is in the STL, that is perhaps not likely.
@sdkrystian : I'd suggest seeing if we can put some level of 'hack' into the compiler to recognize this use and exclude it from diagnosis here. We can't have every libstdc++ build before 13 be broken :/
https://github.com/llvm/llvm-project/pull/90152
More information about the cfe-commits
mailing list