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

--- Comment #5 from Ivan Sorokin <vanyacpp at gmail dot com> ---
I would suggest (In reply to Andrew Pinski from comment #4)
>   nullptr_t t, t1 = nullptr;
>   __builtin_memcpy(&a[0], &t, sizeof(t));

> So I suspect this should be marked as invalid.

The questions is how GCC defines memcpy'ing from nullptr_t.

Should it be required to read zero bytes? Or null pointer value? What about
systems where the value of null pointer is not zero?

In any case I don't think memcpy'ing nullptr_t into a different type is
particularly useful or used anywhere (I might be wrong). So I suggest defining
nullptr_t as an empty type containing only padding bytes. In this case memcpy
should just read the padding bytes.

Reply via email to