Title
Base class access in aggregate initialization
Status
open
Section
11.8.5 [class.protected]
Submitter
Richard Smith

Created on 2016-03-08.00:00:00 last changed 80 months ago

Messages

Date: 2018-03-15.00:00:00

Notes from the March, 2018 meeting:

CWG affirmed the earlier direction and felt that there should be an implicit object expression assumed for these cases.

Date: 2016-12-15.00:00:00

Notes from the December, 2016 teleconference:

The consensus favored accepting f and g while rejecting h.

Date: 2018-04-11.00:00:00

The rules in 11.8.5 [class.protected] assume an object expression, perhaps implicit, that can be used to determine whether access to protected members is permitted or not. It is not clear how that applies to aggregates and constructors. For example:

  struct A {
  protected:
    A();
  };
  struct B : A {
    friend B f();
    friend B g();
    friend B h();
  };
  B f() { return {}; }     // ok? 
  B g() { return {{}}; }   // ok? 
  B h() { return {A{}}; }  // ok?
History
Date User Action Args
2018-04-11 00:00:00adminsetmessages: + msg6210
2017-02-06 00:00:00adminsetmessages: + msg5813
2016-03-08 00:00:00admincreate