================ @@ -5680,8 +5680,16 @@ QualType getApproximateType(const Expr *E) { } } if (const auto *UO = llvm::dyn_cast<UnaryOperator>(E)) { - if (UO->getOpcode() == UnaryOperatorKind::UO_Deref) - return UO->getSubExpr()->getType()->getPointeeType(); + if (UO->getOpcode() == UnaryOperatorKind::UO_Deref) { + // We recurse into the subexpression because it could be of dependent + // type. + QualType SubType = getApproximateType(UO->getSubExpr()); + if (auto Pointee = SubType->getPointeeType(); !Pointee.isNull()) + return Pointee; + // Our caller expects a non-null result, even though the SubType is + // supposed to have a pointee. + return SubType; ---------------- HighCommander4 wrote:
Perhaps falling through to the `return Unresolved` would be better? That's a dependent representation of the pointee type, so it seems less misleading than returning the pointer type. (And it's also what other branches in this function do.) https://github.com/llvm/llvm-project/pull/93404 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits