From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DA2513858C83; Fri, 14 Oct 2022 09:35:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA2513858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665740117; bh=LI3cpHjViHf/+H3mhNUrYdNxyGtmKdjWHpslemR4cHo=; h=From:To:Subject:Date:From; b=RvCPJ71gxvRmFJg74sSXlZDEopVZo7tZ1gcjyRINo/NKiQ39WzwsIMNjb5YoDbTJN m2YrSGU2aI11xjzp8m6V9zjSGjaK5RCjXQnI4XbZW0k99GmjwnK/k4Pc1pECRLNZuL nAIuin9fkJ01KHlp4UMNGtK06YTI0a+yhK2CPfdc= From: "xmh970252187 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107260] New: The prvalue with the value 0 that is not a integer literal shouldn't convert to std::nullptr_t Date: Fri, 14 Oct 2022 09:35:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xmh970252187 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107260 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 zer= o=20 > A null pointer constant of integral type can be converted to a prvalue of= type std=E2=80=8B::=E2=80=8Bnullptr_=C2=ADt. GCC accept this example ````cpp std::nullptr_t v =3D (int)0; ```` However, the initializer expression is not an integer literal, it is a prva= lue of integer type with the value 0. It should be rejected. Clang rejects this example. https://godbolt.org/z/fxMo4YKE3=