It's safe?
const int& f() { return 1; }
What I'm trying to do is return some value to const &
This not normal.Returning a link to a temporary one is not true, because accessing it outside the function causes Undefined Behavior .
No, you are returning a link to a temporary variable - this is unsafe. The temporary variable will be destroyed when the function returns.