https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117727

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Timm Bäder from comment #4)
> (In reply to Jakub Jelinek from comment #2)
> > I thought all the bits of the type are padding bits (given that reads of
> > std::nullptr_t  typed objects just don't read any of the bits and simply
> > result in nullptr).
> 
> Is this (all bits if a nullptr_t being padding bits) in the spec or are you
> referring to gcc's implementation?

My understanding of the standard.  But I'm not a C++ lawyer...
The standard says that std::nullptr_t has the same size as void *, but no bits
in it are actually relevant for the value, the value is always nullptr.
Yes, both g++ and clang++ for say
decltype(nullptr) x;

void
foo (decltype(nullptr) y)
{
  x = y;
}
store 0 in there, but I'm not sure we have to.
decltype(nullptr)
bar ()
{
  return x;
}
will just move 0 into the return register, but still I'm not sure if that is
really needed.

Reply via email to