Closed xermicus closed 1 year ago
It's also for unnamed variables?
It's also for unnamed variables?
Yes, you're right. I don't get how this could have worked before, we have been returning storage slots from functions.
Anyway looks good
@seanyoung I think in practice this isn't noticeable on unnamed variables declared in the return parameters, because in that case the variable doesn't really exist until it's returned. It's sort of "shadowed" by something else, until the corresponding return
statement is reached. And by then, the function already returned, so nothing can for example access the slot
, where it would play a role. So it can't have consumers in the function local scope, hence we probably never noticed.
However, I agree, technically, it's still correct to set the storage location.
Variables declared as return parameters can have a storage location too.