[clang] [clang] Implement constexpr bit_cast for vectors (PR #66894)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 27 17:34:16 PDT 2023
================
@@ -7304,6 +7382,21 @@ class BufferToAPValueConverter {
return ArrayValue;
}
+ std::optional<APValue> visit(const VectorType *Ty, CharUnits Offset) {
+ SmallVector<uint8_t, 8> Bytes;
+ if (!Buffer.readObject(Offset, Info.Ctx.getTypeSizeInChars(Ty), Bytes))
+ return std::nullopt;
----------------
zygoloid wrote:
... and here we'll need to not reject if the padding bits are uninitialized.
As a testcase, we should ensure that (for example) this:
```c++
struct A {
long double a, b, c, d;
};
```
can round-trip through a vector of 4 `long double`s.
https://github.com/llvm/llvm-project/pull/66894
More information about the cfe-commits
mailing list