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

2025-11-07


3093. Missing integration of direct base class relationships

Section: 7.5.9  [expr.prim.splice]     Status: ready     Submitter: US     Date: 2025-10-01

N5028 comment US 27-059

(From submissions #777 and #778.)

Subclause 7.5.9 [expr.prim.splice] paragraph 2 makes no provision for splicing a reflection representing a direct base class relationship, yet 7.6.1.5 [expr.ref] bullet 8.6 presupposes that this is possible.

Furthermore, 6.3 [basic.def.odr] paragraph 3 does not consider direct base class relationships, nor does 13.8.3.3 [temp.dep.expr] paragraph 5.

Proposed resolution (approved by CWG 2025-11-05):

  1. Change in 6.3 [basic.def.odr] bullet 3.3 as follows:

    • ...
    • If E is a class member access expression (7.6.1.5 [expr.ref]) of the form E1 . templateopt E2 naming , where E2 designates a non-static data member or a direct base class relationship, the set contains the potential results of E1.
    • ...
  2. Change in 7.2.1 [basic.lval] bullet 1.1 as follows:

    • A glvalue is an expression whose evaluation determines the identity of an object, function, or non-static data member, or direct base class relationship.
    • ...
  3. Insert a paragraph before 7.5.5.1 [expr.prim.id.general] paragraph 5 as follows:

    A splice-expression that designates a direct base class relationship shall appear only as the second operand of a class member access.

    For an id-expression that denotes an overload set, overload resolution is performed ...

  4. Insert before 7.5.9 [expr.prim.splice] bullet 2.4 as follows:

    • Otherwise, if S is a direct base class relationship (D, B), the expression is an lvalue designating S. The expression has the type B.
    • Otherwise, if S is a variable or a structured binding, ...
  5. Change in 7.6.1.5 [expr.ref] paragraph 10 as follows:

    If E2 designates a non-static member (possibly after overload resolution) or direct base class relationship and the result of E1 is an object whose type is not similar (7.3.6 [conv.qual]) to the type of E1, the behavior is undefined. ...
  6. Change in 12.4.6 [over.ref] paragraph 1 as follows:

    A class member access operator function is a function named operator-> that is a non-static member function taking no non-object parameters. For an expression of the form
      postfix-expression -> templateopt id-expression
    
    the operator function is selected by overload resolution (12.2.2.3 [over.match.oper]), and the expression is interpreted as
      ( postfix-expression . operator -> () ) -> templateopt id-expression
    
    Analogously, for an expression of the form
      postfix-expression -> splice-expression
    
    the operator function is selected by overload resolution, and the expression is interpreted as
      ( postfix-expression . operator -> () ) -> splice-expression
    
  7. Change in 13.8.3.3 [temp.dep.expr] paragraph 5 as follows:

    A class member access expression (7.6.1.5 [expr.ref]) is type-dependent if
    • the terminal name of its id-expression, if any, is dependent,
    • its splice-expression, if any, is type-dependent, or
    • the expression refers to a member of the current instantiation and the type of the referenced member is dependent.