Currently IRGen doesn't handle variables captured by a block correctly when the variable is captured by reference by a lambda that encloses the block.
For example, in the following code, the type of capture 'x' in the block literal is a reference to 'id' because 'x' is captured by reference by the enclosing lambda. In this case, copy/dispose functions shouldn't be needed, but currently IRGen emits them.
void test() { id x; [&]{ ^{ (void)x; }(); }(); }
This happens because there are a few places in CGBlocks.cpp that use the variable's type ('id' in the example above) instead of the capture type ('id &' in the example above).