zygoloid wrote:

> How about:
> [...]

Yeah, I think that fixes it. For me that looks a lot less simple than using a 
union, but it is nice to have only a single implementation. I'd be fine with 
going in that direction.

For CHERI, can we assume that the least-significant byte of the pointer 
representation is even when the alignment of the type is > 1?

> The std::launder may be unnecessary

Formally I think it's correct and necessary for the pointer and integer case 
because an array element and an object for which the array provides storage are 
not pointer-interconvertible, but it's incorrect for the `unsigned char` case 
because there's no in-lifetime `unsigned char` object at the provided address.

https://github.com/llvm/llvm-project/pull/111995
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to