================ @@ -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 ---------------- jyknight wrote:
The (not modified by this PR) comment for the previous stanza `C23 6.5.4p4:` is wrong. It's presumably from an old draft of C23, as it matches the _implementation_ we have, but not the actual standard. The section number is also different. It should now be (From N3299): > C23 6.5.5p4: > The type nullptr_t shall not be converted to any type other than void, bool > or a > pointer type. If the target type is nullptr_t, the cast expression shall be a > null pointer constant or > have type nullptr_t. I think that one comment then covers both stanzas (again), and you don't need another comment here. 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