It shouldn't work. An explicit type conversion to float
with cast notation will be a prvalue (§5.4):
The result of the expression
(T)
cast-expression is of typeT
. The result is an lvalue if T is an lvalue reference type or an rvalue reference to function type and an xvalue if T is an rvalue reference to object type; otherwise the result is a prvalue.
My emphasis added.
The assignment operator requires an lvalue as its left operand (§5.17):
All require a modifiable lvalue as their left operand and return an lvalue referring to the left operand.
A prvalue is not an lvalue.