forked from OSchip/llvm-project
Allow static_cast to objective-c pointers.
Fixes radar 7952457. llvm-svn: 103447
This commit is contained in:
parent
341db487a8
commit
eee1669adb
|
@ -578,8 +578,9 @@ static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr,
|
|||
return TC_Success;
|
||||
}
|
||||
}
|
||||
else if (CStyle && DestType->isObjCObjectPointerType()) {
|
||||
// allow c-style cast of objective-c pointers as they are pervasive.
|
||||
else if (DestType->isObjCObjectPointerType()) {
|
||||
// allow both c-style cast and static_cast of objective-c pointers as
|
||||
// they are pervasive.
|
||||
Kind = CastExpr::CK_AnyPointerToObjCPointerCast;
|
||||
return TC_Success;
|
||||
}
|
||||
|
|
|
@ -9,3 +9,18 @@ void func() {
|
|||
|
||||
obj = vv; // expected-error{{assigning to 'XX *' from incompatible type 'void *'}}
|
||||
}
|
||||
|
||||
// <rdar://problem/7952457>
|
||||
@interface I
|
||||
{
|
||||
void* delegate;
|
||||
}
|
||||
- (I*) Meth;
|
||||
- (I*) Meth1;
|
||||
@end
|
||||
|
||||
@implementation I
|
||||
- (I*) Meth { return static_cast<I*>(delegate); }
|
||||
- (I*) Meth1 { return reinterpret_cast<I*>(delegate); }
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in New Issue