b51f44e21b
For types that are passed by value, we can't just cast the value to a pointer, but have to use an alloca and copy the value there. This handling is already present for all other arguments, but was missing for "self". Fixes #6682, #4850 and #4878