C++ Logo


Advanced search

Re: Shouldn't members need equal alignments to be in the common initial sequence?

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Mon, 2 May 2022 22:27:18 +0200
On 02/05/2022 22.16, Brian Bi wrote:
> On Mon, May 2, 2022 at 7:06 AM Jens Maurer <Jens.Maurer_at_[hidden] <mailto:Jens.Maurer_at_[hidden]>> wrote:
> On 02/05/2022 03.29, Brian Bi via Std-Discussion wrote:
> > The standard has the following to say about the common initial sequence, [class.mem.general] paragraphs 23 through 26:
> >
> > The common initial sequence of two standard-layout struct ([class.prop]) types is the longest sequence of non-static data members and bit-fields in declaration order, starting with the first such entity in each of the structs, such that corresponding entities have layout-compatible types ([basic.types]), either both entities are declared with the no_­unique_­address attribute ([dcl.attr.nouniqueaddr]) or neither is, and either both entities are bit-fields with the same width or neither is a bit-field.
> [...]
> > There is no requirement that corresponding non-static members have the same alignment, so it appears that these two structs are layout-compatible, for example:
> Yes, that looks like a bug in the standard.
> If you have a github account, feel free to create an issue here:
> https://github.com/cplusplus/CWG/issues <https://github.com/cplusplus/CWG/issues>
> Thanks, for some reason I thought github was only for "editorial" issues.

This particular issue tracker is for submitting core issues.
There's another issue tracker for editorial issues.

> If we can submit non-editorial issues on github now, it seems that https://isocpp.org/std/submit-issue <https://isocpp.org/std/submit-issue> might be out of date. (Or does the wg21bot_at_[hidden] <mailto:wg21bot_at_[hidden]> address automatically open up an issue on github?)

That's another channel; not everybody has a github account.


Received on 2022-05-02 20:27:23