Title
Placement of an unrelated complete object in the padding of another complete object
Status
tentatively ready
Section
6.8.2 [intro.object]
Submitter
CWG

Created on 2026-01-23.00:00:00 last changed 5 days ago

Messages

Date: 2026-02-06.22:00:31

Proposed resolution (approved by CWG 2026-02-06):

Change in 6.8.2 [intro.object] paragraph 10 as follows:

... The address of a subobject of zero size is the address of an unspecified byte of storage occupied by the complete object of that subobject.

Given two complete objects with overlapping lifetimes, a byte in the object representation of one may have the same address as a byte in the object representation of the other if

  • one object is nested within the other or
  • they are both potentially non-unique objects;
otherwise, such bytes have distinct addresses.

Date: 2026-01-23.00:00:00

Consider:

struct A {
  char c;
  int i;
} a;

char d;

There is likely going to be padding between a.c and a.i. For lack of an explicit prohibition, the implementation could put d into that padding. This is undesirable.

History
Date User Action Args
2026-02-06 22:00:31adminsetstatus: open -> tentatively ready
2026-01-25 08:23:54adminsetmessages: + msg8465
2026-01-23 00:00:00admincreate