public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107260] New: The prvalue with the value 0 that is not a integer literal shouldn't convert to std::nullptr_t
@ 2022-10-14  9:35 xmh970252187 at gmail dot com
  2022-10-14  9:59 ` [Bug c++/107260] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: xmh970252187 at gmail dot com @ 2022-10-14  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-14 15:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14  9:35 [Bug c++/107260] New: The prvalue with the value 0 that is not a integer literal shouldn't convert to std::nullptr_t xmh970252187 at gmail dot com
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

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).