Ensure that the return type of a function is Sized

Fixes #18107