[PATCH] D66831: [ObjC] Fix type checking for qualified id block parameters.

ChatWyn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 23:57:27 PDT 2020


chatwyn added a comment.

Hi:
we're in the process of testing with Clang 10 and noticed a behavior change caused by this commit.

Consider the following piece of code:

  @protocol P
  @end
  
  @protocol Q
  @end
  
  @interface I <P,Q>
  @end
  
  void a() {
      void (^genericBlockWithParam)(id <P>);
      void (^blockWithParam)(I *);
      blockWithParam = genericBlockWithParam;
      genericBlockWithParam = blockWithParam;
  }

when I use clang 9, it will be  below error

  incompatible block pointer types assigning to 'void (^__strong)(I *__strong)' from 'void (^__strong)(__strong id<P>)'
      blockWithParam = genericBlockWithParam;
                     ^ ~~~~~~~~~~~~~~~~~~~~~

but in clang 10, the error is that

  incompatible block pointer types assigning to 'void (^__strong)(__strong id<P>)' from 'void (^__strong)(I *__strong)'
  genericBlockWithParam = blockWithParam;
                     ^ ~~~~~~~~~~~~~~~~~~~~~

I think clang 9 is reasonable.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66831





More information about the llvm-commits mailing list