In this recent question, we saw that it's not allowed to reinterpret_cast some custom class type instance to itself; struct A{}; reinterpret_cast<A>(A{}); is invalid (it works only through references or pointers). Which seems to make sense, because of the lack of real-world scenarios where such identity conversion is necessary.
Checking the corresponding standard clause, we have in [expr.reinterpret.cast] (emphasis mine):
1 [...] Conversions that can be performed explicitly using
reinterpret_castare listed below. No other conversion can be performed explicitly usingreinterpret_cast.2 [...] An expression of integral, enumeration, pointer, or pointer-to-member type can be explicitly converted to its own type; such a cast yields the value of its operand.
So reinterpret_cast<int>(42) is allowed, while the same cast with a struct A{} is not. Why?