This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2026-02-06


3152. Placement of an unrelated complete object in the padding of another complete object

Section: 6.8.2  [intro.object]     Status: tentatively ready     Submitter: CWG     Date: 2026-01-23

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.

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

otherwise, such bytes have distinct addresses.