Reputation: 424
clang-cl (4.0.0-trunk) seems to think yes while vc2015 (update3) thinks no.
Is this implementation defined or the standard dictates how lambda functions should be implemented in terms or nothrow and move assignable?
#include <type_traits>
#include <iostream>
template <typename T>
void test_nothrow_move_assignable(T&&) {
std::cout << std::boolalpha
<< std::is_nothrow_move_assignable<T>::value
<< "\n";
}
int main() {
test_nothrow_move_assignable([]{});
return 0;
}
// $ clang-cl.exe scratch.cpp
// $ scratch.exe
// true
// $ cl /nologo /EHsc scratch.cpp
// scratch.cpp
// $ scratch.exe
// false
Upvotes: 4
Views: 212
Reputation: 303147
This is clang bug. From [expr.prim.lambda]:
The closure type associated with a lambda-expression has no default constructor and a deleted copy assignment operator. It has a defaulted copy constructor and a defaulted move constructor (12.8).
So the type shouldn't be move assignable at all, much less nothrow move assignable.
Upvotes: 4