It doesn't say const anywhere in the code!
Presumably it is moaning that you are passing an unnamed temporary value (i.e. return value from f5()) as a reference parameter which isn't legal (but may be allowed with a warning) since you don't want to be modifying an unnamed temporary value by accident.
X myX = f5();
instead, that should work...
EDIT: And we aren't psychic (try the math & psychics forum instead for that) please post the full error message and compiler you are using next time kthx ;)