================ @@ -3115,11 +3115,24 @@ void CastOperation::CheckCStyleCast() { Self.CurFPFeatureOverrides()); } } - if (DestType->isNullPtrType() && !SrcType->isNullPtrType()) { - Self.Diag(SrcExpr.get()->getExprLoc(), diag::err_nullptr_cast) - << /*type to nullptr*/ 1 << SrcType; - SrcExpr = ExprError(); - return; + // C23 6.3.2.4p2: a null pointer constant or value of type nullptr_t may be + // converted to nullptr_t. + if (DestType->isNullPtrType()) { ---------------- jyknight wrote:
Can make the first line `if (DestType->isNullPtrType() && !SrcType->isNullPtrType()) {`, to simplify. https://github.com/llvm/llvm-project/pull/133742 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits