[clang] [clang-tools-extra] [clang] Improve nested name specifier AST representation (PR #147835)

Devon Loehr via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 15 10:21:16 PDT 2025


DKLoehr wrote:

I don't know if this is the same as the other crash report, but we're also seeing assert failures when building chromium. I've minimized the repro to the following program:
```
template <typename T> struct S {
  using typename T::Ty;
  static Ty Val;
};
template <typename T>
S<T>::Ty S<T>::Val;
```

This fails when running `clang++ -c repro.cc` when clang is built with asserts (`-std=c++20` silences a warning but isn't necessary). The crash looks like this:
```
llvm-project/clang/include/clang/AST/TypeLoc.h:79: T clang::TypeLoc::castAs() const [T = clang::DependentNameTypeLoc]: Assertion `T::isKind(*this)' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang++ -c repro.cc
1.      p.cc:6:19: current parser token ';'
<snip long backtrace>
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 22.0.0git (https://github.com/llvm/llvm-project.git 91cdd35008e9ab32dffb7e401cdd7313b3461892)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Build config: +assertions
```

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


More information about the cfe-commits mailing list