[PATCH] D62825: [C++2a] Add __builtin_bit_cast, used to implement std::bit_cast

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 13 16:37:34 PDT 2019


rsmith added a comment.

In D62825#1542662 <https://reviews.llvm.org/D62825#1542662>, @rjmccall wrote:

> In D62825#1542639 <https://reviews.llvm.org/D62825#1542639>, @rsmith wrote:
>
> > In my view, the mistake was specifying `nullptr_t` to have the same size and alignment as `void*`; it should instead be an empty type. Only confusion results from making it "look like" a pointer type rather than just being an empty tag type.
>
>
> Perhaps, but that's clearly unfixable without breaking ABI, whereas the object-representation issue is fixable by, at most, requiring a few stores that might be difficult to eliminate in some fanciful situations.


Requiring initialization of, or assignment to, an object of type nullptr_t to actually store a null pointer value is also an ABI break. (Eg, `void f() { decltype(nullptr) n; g(&n); }` does not initialize `n` today in GCC, Clang, or EDG, but would need to do so under the new rule.)

In any case, I've started a discussion on the core reflector. We'll see where that goes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62825/new/

https://reviews.llvm.org/D62825





More information about the cfe-commits mailing list