This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


2302. Address comparison between different member subobjects

Section: 7.6.10  [expr.eq]     Status: NAD     Submitter: Daveed Vandevoorde     Date: 2016-04-29

According to 7.6.10 [expr.eq] bullet 2.1,

Comparing pointers is defined as follows:

The use of the term “complete object” is confusing. A complete object is one that is not a subobject of any other object (6.7.2 [intro.object] paragraph 2), so this restriction apparently does not apply to non-static data members. Is the following guaranteed to work?

  struct S {
    int i[2];
    int j[2];

  constexpr bool check1() {
    S s = { { 1, 2 }, { 3, 4 } };
    return &s.i[2] == &s.j[0];

  static_assert(check1(), "Guaranteed?");

In particular, is there a guarantee that there is no padding between nonstatic data members of the same type?

Rationale (July, 2017):

CWG determined that the existing wording is correct: the result of the comparison is implementation-defined, but not unspecified, so the program is well-formed but the assertion is not guaranteed to pass.