etl/include
Roland Reichwein c52b2ac7b1
Fix etl::mem_cast cross-size copy constructor and assignment (#1488)
The templated cross-size copy constructor and assignment operator were
broken in two ways:

- They accessed other.buffer / rhs.buffer, which is private in a
  different mem_cast instantiation, so the cross-size overloads failed
  to compile whenever they were actually instantiated.
- They copied Size_ (the destination size) bytes from a source buffer
  that is only Other_Size bytes large, reading past the end of the
  source when the destination was larger.

Use the public data() accessor and copy Other_Size bytes. The existing
static_assert(Size >= Other_Size) guarantees the destination is big
enough.

Add test_mem_cast_copy_and_assign_from_smaller regression test.

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
2026-07-07 18:06:05 +02:00
..
etl Fix etl::mem_cast cross-size copy constructor and assignment (#1488) 2026-07-07 18:06:05 +02:00