Check for borrow of local variable introduced within static block.

(Rather than ICE on it.)

Fix #18118.