https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70832
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-04-28
Ever confirmed|0 |1
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
namespace std {
template<typename T> struct remove_reference { using type = T; };
template<typename T> struct remove_reference<T&> { using type = T; };
template<typename T> struct remove_reference<T&&> { using type = T; };
template <class T>
constexpr typename remove_reference<T>::type&&
move(T&& t) noexcept
{ return static_cast<typename remove_reference<T>::type&&>(t); }
}
int main() {
struct move_only {
move_only() = default;
move_only(const move_only&) = delete;
move_only(move_only&&) = default;
move_only& operator=(const move_only&) = delete;
move_only& operator=(move_only&&) = default;
};
auto lambda = [test = move_only{}]{};
auto lambda_moved = std::move(lambda);
lambda = std::move(lambda_moved);
}
move.cc: In function ‘int main()’:
move.cc:22:36: error: use of deleted function ‘main()::<lambda()>&
main()::<lambda()>::operator=(const main()::<lambda()>&)’
lambda = std::move(lambda_moved);
^
move.cc:20:38: note: a lambda closure type has a deleted copy assignment
operator
auto lambda = [test = move_only{}]{};
^