On 16.07.2017 21:49, Guillaume Boucher wrote:

I'd say a function with return type Bottom can override any function in the base class.

That solves the "Penguin : Bird" step, but not "EvolvedPenguin : Penguin" (which can fly).

Andrei argues that my example don't comply with a puristic understanding of inheritance. Maybe that's enough of a reason to not optimize such use cases, but it still shows that pragma(noreturn) is somehow stronger than Bottom.

The issue isn't purism, it is type safety. If you create an EvolvedPenguin, upcast it to a Penguin and call the fly method you get UB. So noreturn would indeed need to enforce that all overrides are also noreturn.

Reply via email to