Title
Temporary materialization and base/member initialization
Status
drafting
Section
11.9.3 [class.base.init]
Submitter
Daveed Vandevoorde

Created on 2018-12-11.00:00:00 last changed 17 months ago

Messages

Date: 2022-08-15.00:00:00

Additional note (August, 2022):

If there are concerns about reuse of tail padding in #1, requiring a copy for some implementation reason, similar concerns should apply to #2 if the data member is declared with [[no_unique_address]].

Furthermore, the following example using a delegating constructor shows implementation divergence:

struct Noncopyable {
  Noncopyable();
  Noncopyable(const Noncopyable &) = delete;
  Noncopyable(int) : Noncopyable(Noncopyable()) {} // #3?
};
Date: 2018-12-11.00:00:00

Given the following example,

  struct Noncopyable {
    Noncopyable();
    Noncopyable(const Noncopyable &) = delete;
  };

  Noncopyable make(int kind = 0);

  struct AsBase : Noncopyable {
    AsBase() : Noncopyable(make()) {} // #1
  };

  struct AsMember {
    Noncopyable nc;
    AsMember() : nc(make()) { }  // #2?
  };

All implementations treat #1 as an error, invoking the deleted copy constructor, while #2 is accepted. It's not clear from the current wording why they should be treated differently.

History
Date User Action Args
2022-11-25 07:46:02adminsetstatus: open -> drafting
2022-08-23 21:19:27adminsetmessages: + msg6897
2018-12-11 00:00:00admincreate