O'Reilly logo
  • Chris Kang thinks this is interesting:

Now consider what could happen if this initialization were allowed but ri was not const. If ri weren’t const, we could assign to ri. Doing so would change the object to which ri is bound. That object is a temporary, not dval. The programmer who made ri refer to dval would probably expect that assigning to ri would change dval. After all, why assign to ri unless the intent is to change the object to which ri is bound? Because binding a reference to a temporary is almost surely not what the programmer intended, the language makes it illegal.


Cover of C++ Primer, Fifth Edition


this is why the const reference can be bound to type that is not exactly the same. i.e. long type is bound to const int type. you are not allowed to change the value through the const int reference because it is bound to a temp memory created by c++.
need to check this out to confirm.