[clang] [clang] Bind the __builtin_bit_cast operand as std::bit_cast binds its parameter (PR #231830)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 18 12:39:34 PDT 2026
================
@@ -3404,6 +3404,15 @@ void CastOperation::CheckBuiltinBitCast() {
return;
}
+ if (SrcExpr.get()->isGLValue() &&
----------------
Nemi26 wrote:
Done, it now uses PerformCopyInitialization to a `const From &`. Global register variables aren't covered, since the reference binds to them directly and that's already broken outside bit_cast (#233283).
`From` keeps the operand's qualifiers, as with `std::bit_cast`, so volatile lvalues are still accepted, and the load is now volatile. Volatile bit-fields are rejected, as with `std::bit_cast`.
https://github.com/llvm/llvm-project/pull/231830
More information about the cfe-commits
mailing list