Title
Temporaries and previously-initialized elements in aggregate initialization
Status
open
Section
9.4.2 [dcl.init.aggr]
Submitter
Daveed Vandevoorde

Created on 2019-03-13.00:00:00 last changed 28 months ago

Messages

Date: 2019-03-13.00:00:00

There is implementation divergence with respect to an example like:

  constexpr int f(int &r) { r *= 9; return r - 12; }
  struct A { int &&temporary; int x; int y; };

  constexpr A a1 = { 6, f(a1.temporary), a1.temporary }; // #1 

Some implementations accept this code and others say that a1.temporary is not a constant expression in the initializer at #1.

History
Date User Action Args
2019-03-13 00:00:00admincreate