public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xmh970252187 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-107260-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2022-10-14  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14  9:35 xmh970252187 at gmail dot com [this message]
2022-10-14  9:59 ` [Bug c++/107260] " redi at gcc dot gnu.org
2022-10-14 13:21 ` mpolacek at gcc dot gnu.org
2022-10-14 13:52 ` mpolacek at gcc dot gnu.org
2022-10-14 15:14 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-107260-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).