Created on 2009-02-09.00:00:00 last changed 178 months ago
[Voted into the WP at the July, 2009 meeting as part of N2927.]
Proposed resolution (July, 2009)
See document PL22.16/09-0117 = WG21 N2927.
According to 7.5.6 [expr.prim.lambda] paragraph 11, the closure class “has a public move constructor that performs a member-wise move.” Although the terms “move constructor” and “member-wise move” are not currently defined (see issue 680), this presumably means that a lambda like [&i]{} results in a closure class similar to:
class F { int& i; public: F(&& other): i(std::move(other.i)) { } // etc. };
This constructor is ill-formed because it attempts to initialize an lvalue reference to non-const int with the rvalue returned by std::move.
It is not clear whether this should be handled by:
Not generating the move constructor.
Generating the declaration of the move constructor but only defining it (and giving the corresponding error) if the move constructor would be used, similar to the handling of other implicitly-defined special member functions.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | status: wp -> cd2 |
2009-11-08 00:00:00 | admin | set | status: dr -> wp |
2009-08-03 00:00:00 | admin | set | messages: + msg2246 |
2009-08-03 00:00:00 | admin | set | status: review -> dr |
2009-03-23 00:00:00 | admin | set | messages: + msg1914 |
2009-02-09 00:00:00 | admin | create |