C++ Logo


Advanced search

Re: [std-proposals] [Draft Proposal] Required attribute syntax

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Thu, 4 May 2023 21:57:24 +0200
On 04/05/2023 14.27, Lauri Vasama via Std-Proposals wrote:
> That's right. My intention is not at all to try to force Microsoft's hand. Their hesitation to implement [[no_unique_address]] serves to demonstrate the problem with the ignorability of attributes, though of course there is no problem if attributes never affect program behaviour, but that particular cat is now out of the bag. I can't speak for Microsoft of course, but i believe they would not have the same objection to implementing no_unique_address if its use was ill formed in compiler versions or language modes where it is not supported.

Note carefully that the "ignorability" rule says that you must ignore all
instances of an attribute in the entire program. Selectively ignoring
a few instances (e.g. per translation unit) is not supported.

Thus, anyone feeling that they want to make the ABI breakage of
[[no_unique_address]] visible loudly might want to start mangling
classes having a [[no_unique_address]] member differently. That
way, you get linker errors if you pass one of those classes with
inconsistent [[no_unique_address]] treatment across function call
boundaries. That's not a complete approach because it doesn't
detect "sizeof(T)" differences, but it's a start.


Received on 2023-05-04 19:57:28