The temporary value is not constant:
C(); // not const
If you want to constantly refer to it, do it:
f(static_cast<const C&>(C()));
The fact is that an object whose member function (here the conversion operator) is called is not a constant. This has nothing to do with the result of the conversion.
Actually, the result is not permanent. Suppose we add another class:
class D { }; class C {
source share