Created on 2011-08-12.00:00:00 last changed 81 months ago
[Moved to DR at the November, 2016 meeting as paper P0507R0.]
Proposed resolution (June, 2016):
The resolution is given in paper P0507R0.
Additional note (October, 2015):
For additional examples, consider:
int i = i++; int j = j;
The current sequencing rules do not cover these initializations.
Also, in
const int& f(const int& x) { return x; } int y = f(5);
it doesn't appear that 6.9.1 [intro.execution] paragraph 10 requires the temporary for 5 to persist until the initialization of y is complete.
Additional note (February, 2014):
Aggregate initialization could also involve more than one full-expression, so the limitation above to “initialization of a non-class object” is not correct.
Additional note, April, 2013:
There is implementation variance in the treatment of the following example:
struct A { A() { puts("ctor"); } A(const A&) { puts("copy"); } const A&get() const { return *this; } ~A() { puts("dtor"); } }; struct B { B(A, A) {} }; typedef A A2[2]; A2 a = { A().get(), A().get() }; B b = { A().get(), A().get() }; int c = (A2{ A().get(), A().get() }, 0); int d = (B{ A().get(), A().get() }, 0); int main() {}
The current wording does not indicate that initialization of a non-class object is a full-expression, but presumably should do so.
History | |||
---|---|---|---|
Date | User | Action | Args |
2018-02-27 00:00:00 | admin | set | status: dr -> c++17 |
2017-02-06 00:00:00 | admin | set | messages: + msg6087 |
2017-02-06 00:00:00 | admin | set | messages: + msg6086 |
2017-02-06 00:00:00 | admin | set | status: drafting -> dr |
2015-11-10 00:00:00 | admin | set | messages: + msg5631 |
2014-03-03 00:00:00 | admin | set | messages: + msg4872 |
2013-05-03 00:00:00 | admin | set | messages: + msg4328 |
2011-08-12 00:00:00 | admin | create |