[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 17:21:33 PDT 2019


jfb added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:5447
+
+    case APValue::LValue: {
+      LValue LVal;
----------------
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...


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