Patch to allow cstyle cast of objective-c pointers in objective-c++

mode as they are pervasive.

llvm-svn: 90867
This commit is contained in:
Fariborz Jahanian 2009-12-08 19:22:33 +00:00
parent c5d082fd5d
commit 1c548021ec
2 changed files with 24 additions and 0 deletions

View File

@ -1160,6 +1160,10 @@ bool Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
if (CastTy->isDependentType() || CastExpr->isTypeDependent())
return false;
// allow c-style cast of objective-c pointers as they are pervasive.
if (CastTy->isObjCObjectPointerType())
return false;
if (!CastTy->isLValueReferenceType() && !CastTy->isRecordType())
DefaultFunctionArrayConversion(CastExpr);

View File

@ -0,0 +1,20 @@
// RUN: clang-cc -fsyntax-only -verify %s
@protocol P @end
@interface I @end
int main() {
void *cft;
id oct = (id)cft;
Class ccct;
ccct = (Class)cft;
I* iict = (I*)cft;
id<P> pid = (id<P>)cft;
I<P> *ip = (I<P>*)cft;
}