Are not the literals 1, 2, 3 const rvalues?
No, they are just rvalues ββof type int. According to the C ++ standard, the values ββof primitive types cannot be const-qual.
The call fails because they are rvalues ββ- non-const links cannot be associated with rvalues.
The call will be OK if the functions took const A1 &, const A2&, const A3& , but in this case the function will not be able to change the arguments.
Edit: Link to my first statement from the C ++ 2003 standard: (3.10.9)
Class values ββcan have cv-qualified types; nonclass values ββalways have cv-unqualified types. Values ββshould always have full types or void type; in addition to these types, lvalues ββcan also be incomplete types.
source share