is_assignable
is true if:
The expression declval() = declval()
is well-formed
declval
is declared as a function returning a reference to T
:
template
typename add_rvalue_reference::type declval() noexcept;
where add_rvalue_reference::type
is an rvalue reference type (T&&
) if T
is an object or function type, or T
itself if it is a reference type.
This means that is_assignable
can only be true if T
is a non-const lvalue reference type. If it's an object type, then add_rvalue_reference::type
is an rvalue reference type; so the expression declval()
is an xvalue, which cannot be assigned to.
So, unless I've misread the standard, GCC is correct and VS2012 is wrong. Even if it might seem to make more sense for is_assignable
to be true, it is not.