is_assignable::value
is defined as true when declval() = declval()
is well-formed and declval
is defined as a function returning add_rvalue_reference::type
.
We must remember that an assignment is only valid for a modifiable lvalue as the left operand. Also remember the rules of reference collapsing (especially the last two):
T& & -> T&
T&& & -> T&
T& && -> T&
T&& && -> T&&
So each case:
is_assignable
and is_assignable
Can we assign the result of a function returning an rvalue reference (an xvalue) to the result of another function returning an rvalue reference (another xvalue). No we can't. This should be false
.
std::is_assignable
and std::is_assignable
Can we assign the result of a function returning an rvalue reference (an xvalue) to the result of a function returning an lvalue reference (an lvalue). We sure can. This should be true
.
std::is_assignable
and std::is_assignable
Can we assign the result of a function returning an lvalue reference (an lvalue) to the result of a function returning an rvalue reference (an xvalue). No we can't. This should be false
.
So I say GCC is right here.