[Bug c++/89745] [[no_unique_address]] has no effect in some cases

2019-03-17 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89745

Marc Glisse  changed:

   What|Removed |Added

   Keywords||ABI

--- Comment #3 from Marc Glisse  ---
This is a weakness of the ABI. There is enough space to put 8 "empty" objects
in parallel to Data, but depending on the exact way you ask for it, the
specification sometimes says to give up looking for reusable space :-( A class
with empty, empty and void* members in this order will have size 8.

[Bug c++/89745] [[no_unique_address]] has no effect in some cases

2019-03-17 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89745

--- Comment #2 from Jonathan Wakely  ---
Right, this is how it's supposed to work. Two different objects of the same
type must have unique addresses.

[Bug c++/89745] [[no_unique_address]] has no effect in some cases

2019-03-17 Thread tower120 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89745

tower120  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from tower120  ---
Sorry, gcc behavior is correct. If empty types should are different - all ok:

struct empty{};
struct empty2{};
using Data = void*;

using P1 = alternative_pair;
using P2 = alternative_pair;