mirror of https://github.com/microsoft/clang.git
objc: DOn't complain if a (SEL) expression is typecast
to (SEL). Fixes // rdar://12859590 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170058 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
206491dcbe
commit
0c252fa8b7
|
@ -1479,6 +1479,8 @@ void Sema::CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
|
||||||
static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr,
|
static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr,
|
||||||
QualType DestType) {
|
QualType DestType) {
|
||||||
QualType SrcType = SrcExpr.get()->getType();
|
QualType SrcType = SrcExpr.get()->getType();
|
||||||
|
if (Self.Context.hasSameType(SrcType, DestType))
|
||||||
|
return;
|
||||||
if (const PointerType *SrcPtrTy = SrcType->getAs<PointerType>())
|
if (const PointerType *SrcPtrTy = SrcType->getAs<PointerType>())
|
||||||
if (SrcPtrTy->isObjCSelType()) {
|
if (SrcPtrTy->isObjCSelType()) {
|
||||||
QualType DT = DestType;
|
QualType DT = DestType;
|
||||||
|
|
|
@ -18,4 +18,7 @@ int main() {
|
||||||
(void *const)s; // ok
|
(void *const)s; // ok
|
||||||
|
|
||||||
(const void *const)s; // ok
|
(const void *const)s; // ok
|
||||||
|
|
||||||
|
// rdar://12859590
|
||||||
|
(SEL)sel_registerName("foo"); // ok
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue