An assertion failure occurs in Clang when attempting to compile such an
example:
```c++
template <typename, typename, bool> struct MozPromise {
class Private;
private:
int mMagic4 = 42;
};
template <typename ResolveValueT, typename RejectValueT, bool IsExclusive>
struct MozPromise<ResolveValueT, RejectValueT, IsExclusive>::Private : MozPromise {
void SetTaskPriority() { mMagic4 ; }
};
```
Output:
```
clang: llvm-project/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From&) [with To = clang::RecordType; From = clang::QualType]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
```
The reason is in the incorrect way of casting types when searching for
names in base classes
```c++
return Specifier->getType()->castAs<RecordType>()->getDecl()->getCanonicalDecl() == BaseRecord;
```
It loses injected types for template class names.
This patch provides fix for such cases
26 KiB
26 KiB