proposed @noreturn attribute

Guillaume Boucher via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 16 14:17:11 PDT 2017


On Sunday, 16 July 2017 at 20:04:25 UTC, Timon Gehr wrote:
> 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.

I see it as some kind of weak guarantee, where the compiler can 
assume noreturn only if he knows there are no subtypes involved 
(e.g. if he's applying devirtualization).

Automatically inheriting the attribute could break existing code 
(especially if it's inferred).


More information about the Digitalmars-d mailing list