[SemaOverload] Use castAs<> instead of getAs<> to avoid dereference of nullptr

The pointer is always dereferenced inside BuildSimilarlyQualifiedPointerType, so assert the cast is correct instead of returning nullptr
This commit is contained in:
Simon Pilgrim 2022-01-10 17:31:35 +00:00
parent 18b2385f2b
commit c61299e2b3
1 changed files with 2 additions and 3 deletions

View File

@ -2405,9 +2405,8 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
if (FromType->isObjCObjectPointerType() && ToPointeeType->isVoidType() &&
!getLangOpts().ObjCAutoRefCount) {
ConvertedType = BuildSimilarlyQualifiedPointerType(
FromType->getAs<ObjCObjectPointerType>(),
ToPointeeType,
ToType, Context);
FromType->castAs<ObjCObjectPointerType>(), ToPointeeType, ToType,
Context);
return true;
}
const PointerType *FromTypePtr = FromType->getAs<PointerType>();