summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r--lib/Sema/SemaExprObjC.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index d7e4e4a..b78c10b 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -636,7 +636,11 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
// Implicitly convert integers and pointers to 'id' but emit a warning.
Diag(lbrac, diag::warn_bad_receiver_type)
<< RExpr->getType() << RExpr->getSourceRange();
- ImpCastExprToType(RExpr, Context.getObjCIdType());
+ if (ReceiverCType->isPointerType())
+ ImpCastExprToType(RExpr, Context.getObjCIdType(), CastExpr::CK_BitCast);
+ else
+ ImpCastExprToType(RExpr, Context.getObjCIdType(),
+ CastExpr::CK_IntegralToPointer);
} else {
// Reject other random receiver types (e.g. structs).
Diag(lbrac, diag::err_bad_receiver_type)
OpenPOWER on IntegriCloud