Ensure that the destination slot exists in this case. This addresses PR51484.
Not all constants are emitted within the context of a function, so use the module's ASTContext instead because 1) that's the same as the current function ASTContext, and 2) the module can never be null. Fixes PR50787.