================ @@ -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; ---------------- zyn0217 wrote:
Thanks, I think that makes sense in the case of dereferencing a non-pointer type, which is ill-formed and we probably should offer nothing for completion. 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