bottom type as parameter or local variable, does that make sense?

Elronnd elronnd at elronnd.net
Mon Jan 17 17:53:25 UTC 2022


On Monday, 17 January 2022 at 16:11:03 UTC, Timon Gehr wrote:
> if a type `A*` is a subtype of a type `B*`, then 
> `A.sizeof>=B.sizeof`. `noreturn*` is a subtype of any `T*`. 
> Hence, `noreturn.sizeof` should be at least `size_t.max` or 
> even `∞`.

I don't think this is right; it must be that A.sizeof==B.sizeof.  
Consider e.g.:

B* f(B* b) { return b+1; }

What happens if you pass in an A*, and A.sizeof>B.sizeof?


More information about the Digitalmars-d mailing list