
16 Jul
2011
16 Jul
'11
9:22 p.m.
I think you're mis-diagnosing this error. Experiments suggest that when RET=int the cv-qualifiers are ignored on the function return type, so rc, rv, and rcv are all defining functions identical to r. When RET=ret the qualifiers are not ignored.
I can't find anything in the C++0x standard (N3290) to suggest that this should happen.
Just found the explanation in C++98 standard (3.10 Lvalues and rvalues): "Class rvalues can have cv-qualified types; non-class rvalues always have cv-unqualified types." This confirms what you wrote: cv qualifiers are ignored in non-class return types (int...). Of course, this does not help me a lot... Frédéric