[PATCH] D62825: [C++2a] Add __builtin_bit_cast, used to implement std::bit_cast
JF Bastien via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 3 18:59:45 PDT 2019
jfb added inline comments.
================
Comment at: clang/lib/AST/ExprConstant.cpp:5447
+
+ case APValue::LValue: {
+ LValue LVal;
----------------
rsmith wrote:
> jfb wrote:
> > rsmith wrote:
> > > This will permit bitcasts from `nullptr_t`, providing a zero value. I think that's wrong; the bit representation of `nullptr_t` is notionally uninitialized (despite strangely having pointer size and alignment).
> > >
> > > I think this is a specification bug: `bit_cast<intptr_t>(nullptr)` should be non-constant (it won't necessarily be `0` at runtime) but the current wording doesn't seem to permit us to treat it as non-constant.
> > You brought this up in ABQ, the outcome was... poor notes so I have no idea what Core decided...
> It looks like we never actually resolved what happens in this case ;-(
IIRC we discussed having the same-ish issue with `bool`, or any other indeterminate bit pattern. Realistically it's zero...
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62825/new/
https://reviews.llvm.org/D62825
More information about the cfe-commits
mailing list