specialNoreturnCast

A helper function to "cast" from expressions of type noreturn to any other type - noreturn is implicitly convertible to any other type. However, the dmd backend does not like a naive cast from a noreturn expression (particularly an assert(0)) so this function generates:

(assert(0), value) instead of cast(to)(assert(0)).

value is currently to.init however it cannot be read so could be made simpler.

specialNoreturnCast

Parameters

toBeCasted Expression

Expression of type noreturn to cast

to Type

Type to cast the expression to.

Return Value

A CommaExp, upon any failure ErrorExp will be returned.

Meta