I always believed that temporary objects in C++ are automatically considered as const by the compiler. But recently I experienced that the following example of code:
function_returning_object().some_non_const_method();
is valid for C++ compiler. And it makes me wonder - are temporary objects in C++ const indeed? If yes, then why the code above is considered correct by the compiler?