Title
Unclear definition of member-designator for offsetof
Status
open
Section
17.2.4 [support.types.layout]
Submitter
Corentin Jabot

Created on 2023-08-21.00:00:00 last changed 8 months ago

Messages

Date: 2023-11-07.20:45:23

Consider:

  struct S {
    int a;
  };
  int x = offsetof(S, S::a)

Is this valid? MSVC and gcc appear to support qualified-ids in the member-designator of offsetof; clang does not. Once that question is clarified, the rules about value-dependence may need to be amended, because a qualified-id might introduce type-dependence.

Specific questions:

  • Is a qualified-id allowed to appear in a member-designator?
  • Is a template-id allowed to appear in a member-designator?
  • Is an offsetof expression a core constant expression (7.7 [expr.const])?

2023-08-23

Forwarded to EWG with paper issue #1616, by decision of the CWG chair.

EWG 2023-11-07

EWG is soliciting a paper to thoroughly explore the design space.

History
Date User Action Args
2023-08-21 00:00:00admincreate