https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107260
Bug ID: 107260 Summary: The prvalue with the value 0 that is not a integer literal shouldn't convert to std::nullptr_t Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: xmh970252187 at gmail dot com Target Milestone: --- [conv.ptr] p1 says > A null pointer constant is an integer literal ([lex.icon]) with value zero > A null pointer constant of integral type can be converted to a prvalue of > type std::nullptr_t. GCC accept this example ````cpp std::nullptr_t v = (int)0; ```` However, the initializer expression is not an integer literal, it is a prvalue of integer type with the value 0. It should be rejected. Clang rejects this example. https://godbolt.org/z/fxMo4YKE3