https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77896

--- Comment #5 from Ryan Johnson <scovich at gmail dot com> ---
In an ideal world, C++ would disallow such behavior by default, with a function
attribute of some kind that flags cases where a type change might occur (kind
of like how c++11 assumes `nothrow()` for destructors unless you specify
otherwise). Not only would it allow better optimizations, it would be safer,
because the compiler could then detect and forbid (or at least warn about)
problematic usage of such a class (like stack-allocating it, or calling a
type-change function when cast as the type that's about to change).

Reply via email to