On Mon, 07 Jun 2021 20:11:16 +0200, David Blaikie via Dwarf-Discuss wrote: > On Mon, Jun 7, 2021 at 10:58 AM Jan Kratochvil via Dwarf-Discuss > <dwarf-discuss@lists.dwarfstd.org> wrote: > > > > clang-12 will create the same DWARF for class B with [[no_unique_address]] > > either present or not. Despite that class C derived from B has different > > layout depending on from which class B it gets derived > > Why is this ^ a problem? The layout seems accurate - in that 'a' > shares its address with 'c' - so both members having the same offset > seems like an accurate representation of the layout of the struct?
$ echo 'struct A {}; struct B { [[no_unique_address]] A a; } b;'|clang -Wall -g -c -o a.o -x c++ -;lldb ./a.o (lldb) expr -- struct C:B{char c;};&((C *)nullptr)->c); (lldb) expr -- struct C:B{char c;};sizeof(C); Actual: (char *) $0 = 0x0000000000000001 "" (unsigned long) $1 = 2 Expected: (char *) $0 = 0x0000000000000000 (unsigned long) $1 = 1 Jan _______________________________________________ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org