ahatanak added a comment.

Seems like the chromium code is valid and shouldn't crash. John/Erik what do 
you think? The following code also crashes with this patch applied.

  typedef void (^BlockTy)();
  
  BlockTy sb;
  __weak BlockTy wb;
  
  void foo(id a) {
    auto b = ^{ NSLog(@"foo %@", a); };
    wb = b; // block isn't copied to the heap.
    sb = b; // block is copied to the heap.
  }
  
  int main() {
    auto x = [NSObject new];
    foo(x);
    sb();
    wb();
    return 0;
  }


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58514/new/

https://reviews.llvm.org/D58514



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to