================
@@ -3404,6 +3404,15 @@ void CastOperation::CheckBuiltinBitCast() {
     return;
   }
 
+  if (SrcExpr.get()->isGLValue() &&
----------------
hubert-reinterpretcast wrote:

> Volatile bit-fields are rejected, as with `std::bit_cast`.

Volatile rvalues should also be rejected: https://godbolt.org/z/9jb3b86fo
```cpp
struct A {};
using VA = volatile A;
void f(const auto &);
int main() {
  A a;
  f(static_cast<VA &&>(a));  // error
  (void) __builtin_bit_cast(A, VA{});
}
```

https://github.com/llvm/llvm-project/pull/231830
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to