[PATCH] D67983: [ObjC] Diagnose implicit type coercion from ObjC 'Class' to object pointer types.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 10 12:45:56 PST 2020


jyknight added a comment.

>> Your error looks correct to me -- "self" in a classmethod is not an instance, but the class itself. And while instances of X implement "Delegate", the Class does not.
> 
> Got it, thanks! We might need to add a flag to allow the old behavior temporarily to accommodate our codebase while it's being updated.

Adding an explicit cast would be the simplest way to allow your code to continue being broken in the same way it was previously broken.  E.g.

  // TODO: fix the types here -- self is _not_ actually an id<Delegate>!
  y.d = static_cast<id<Delegate>>(self);


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67983





More information about the cfe-commits mailing list