On 04/06/2017 04:11 PM, Bernd Edlinger wrote:

I think it is not too complicated to done in the C++ FE.
The FE looks for array of std::byte and unsigned char,
and sets the attribute when the final type is constructed.

What I am trying to do is just extend the semantic of may_alias
a bit, and then have the C++ FE use it in the way it has to.

We also need this for some POSIX and Linux kernel interfaces. A C++-only solution would not help with that.

Here is what I want to write in the doc:

@item typeless_storage
@cindex @code{typeless_storage} type attribute
A type declared with this attribute behaves like a character type
with respect to aliasing semantics.
This is attribute is similar to the @code{may_alias} attribute,
except that it is not restricted to pointers.

As Jakub pointed out, this is not what we need here. An object of type char does *not* have untyped storage. Accessing it as a different type is still undefined.

The documentation says that the memory region is considered to by untyped, like a memory region returned by malloc (but obviously not with the implication that the memory region is separated from everything else).

Thanks,
Florian

Reply via email to