C++ Logo

std-proposals

Advanced search

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

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Thu, 4 May 2023 22:12:11 +0200
On 04/05/2023 22.00, Lénárd Szolnoki via Std-Proposals wrote:
> On Thu, 2023-05-04 at 21:57 +0200, Jens Maurer via Std-Proposals wrote:
>>
>>
>> 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.
>
> How do you do that when the class is incomplete?

Hm... I guess you don't. Never mind.

Jens

Received on 2023-05-04 20:12:16