https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92765
--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> --- We explicitly document supporting type punning through unions as an extension, so it is valid in C++ too. And, what union member is active at which point really doesn't matter for the testcases, e.g. in #c6 you could very well pass the union address to bar too and store there to the union member you want active afterwards (or have the union address in some global var from before the function and do it in bar again). The #c7 testcase doesn't contain any union. The #c10 testcase could be changes similarly to the #c6 one.