https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671
--- Comment #88 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- (In reply to rguent...@suse.de from comment #87) > On April 1, 2017 4:40:19 PM GMT+02:00, "bernd.edlinger at hotmail dot de" > <gcc-bugzi...@gcc.gnu.org> wrote: > >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671 > > > >--- Comment #86 from Bernd Edlinger <bernd.edlinger at hotmail dot de> > >--- > >Created attachment 41101 [details] > > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41101&action=edit > >another trial patch > > > >This is another approach for a patch that reflects what I understood > >so far what the C++17 spec wants from us. > >I think it should resolve the issue Richard raised. > > That doesn't properly work with LTO oops... I think this does not work either, at cp/decl.c (start_enum): /* std::byte aliases anything. */ if (enumtype != error_mark_node && TYPE_CONTEXT (enumtype) == std_node && !strcmp ("byte", TYPE_NAME_STRING (enumtype))) TYPE_ALIAS_SET (enumtype) = 0; I looked at -flto -fdump-rtl-final and see the alias set is 1: #include <cstddef> //namespace std { enum class byte: unsigned char {}; }; union t { int x; std::byte k[1]; }; t t1; t t2; void test() { t1.k[0] = t2.k[0]; } int main() { test(); } g++ -std=c++17 -flto -fdump-rtl-final t.cc /tmp/cc*.final: (insn 5 2 6 2 (set (reg:QI 0 ax [orig:87 _1 ] [87]) (mem/j/c:QI (symbol_ref:DI ("t2") [flags 0x2] <var_decl 0x7f2a492dfab0 t2>) [1 t2.k+0 S1 A32])) "t.cc":11 84 {*movqi_internal} (nil)) (insn 6 5 13 2 (set (mem/j/c:QI (symbol_ref:DI ("t1") [flags 0x2] <var_decl 0x7f2a492dfb40 t1>) [1 t1.k+0 S1 A32]) (reg:QI 0 ax [orig:87 _1 ] [87])) "t.cc":11 84 {*movqi_internal} (nil)) [1 = alias set 1 but should be 0