http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52683
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com>
2012-03-23 18:44:47 UTC ---
(In reply to comment #3)
> I'm agree. But if you remove all tests with is_assignable2, still remains
> problem with int:
>
> ...
> struct QQ
> {
> int v;
> };
>
> ...
>
> static_assert( is_assignable<int,int>::value, "not assignable" ); // <----
> fail!
This is to be expected, because is_assignable is the most general assignable
trait. Your compile-time query is equivalent to asking whether the expression
12 = 13;
is well-formed. Use std::is_assignable<int&,int>::value to test for assigning
an int rvalue to a mutable int lvalue. Or even better, use
std::is_copy_assignable<int>
> static_assert( is_assignable<int&,int&&>::value, "not assignable" ); // pass
This works because this corresponds to assigning an int rvalue to an int.
> static_assert( is_assignable<WW,WW>::value, "not assignable" ); // pass
This is to be expected, because rvalues of classes can act as lvalues when they
call a member function.
> static_assert( is_assignable<QQ,QQ>::value, "not assignable" ); // <---- pass!
Same thing as with WW.
> static_assert( is_assignable<QQ&,QQ&&>::value, "not assignable" ); // pass
Also valid, you try to assign an rvalue of Q to a mutable lvalue.
I see no defects here.