Unionizing for Profit: How to Exploit the Power of Unions in C++

  1. Do we support any platforms with ABIs other than ILP32 and LP64?
  2. I don’t think the memcpy loophole relies on padding, just that std::shared_ptr has the same representation as a struct containing two pointers to void. If some weird platform puts padding between the two pointers, I think that the example should still work. I probably should have noted that the real code has a static_assert to make sure we’re not building for a platform where things don’t seem to line up correctly: [PyTorch][JIT] Don't refcount Type singletons by swolchok · Pull Request #69579 · pytorch/pytorch · GitHub