On 28/04/20 19:11 +0200, Jakub Jelinek wrote:
On Tue, Apr 28, 2020 at 12:01:15PM -0500, Segher Boessenkool wrote:
So the attribute says an object of this struct can have the same address
as another object of this struct.  But that is not what the backend code
uses it for!

There is a FAQ at the start of the paper that says various intentions of
that and one of them seems to be that it would be interoperable with
the empty bases, dunno if e.g. using empty bases in C++17 and then in C++20
code use these instead, I think Jonathan could say more.

Our current std::tuple implementation has a number of issues due to
using inheritance, which introduces unwanted coupling between
std::tuple<X> and X.

I want to replace the inheritance with composition, but use the
[[no_unique_address]] attribute to keep the layout identical, so that
there is no ABI change. For that to work the attribute must produce
effects equivalent to an empty base-class (obviously only when the
struct member with the attribute comes first, so it's in the same
position as a base class would have been).

Reply via email to