On Thu, 9 May 2024 at 11:22, Giuseppe D'Angelo via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
Il 09/05/24 12:00, Frederick Virchanza Gotham via Std-Proposals ha scritto:
>
> Same size, same representation, same alignment. So you can do the following:
>
>      char *Func(char *arg)
>      {
>          double*p1 = (double*)arg;
>          int*p2 = (int*)p1;
>          std::string*p3 = (std::string*)p2;
>          return (char*)p3;
>      }
>
> The above function would be well-formed with well-defined behaviour,

Why should this code be well-formed? Strict aliasing is a thing, even in
a world of intercompatible pointers.

There is no aliasing violation here, the pointer is never dereferenced, and ends up with the original type.