[cfe-commits] r110519 - /cfe/trunk/lib/Sema/SemaExpr.cpp
Douglas Gregor
dgregor at apple.com
Sat Aug 7 06:36:37 PDT 2010
Author: dgregor
Date: Sat Aug 7 08:36:37 2010
New Revision: 110519
URL: http://llvm.org/viewvc/llvm-project?rev=110519&view=rev
Log:
Integral-to-pointer conversions are not always null -> member pointer
conversions. Fixes PR7443.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=110519&r1=110518&r2=110519&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Aug 7 08:36:37 2010
@@ -5598,13 +5598,19 @@
if (RHSIsNull &&
(lType->isPointerType() ||
(!isRelational && lType->isMemberPointerType()))) {
- ImpCastExprToType(rex, lType, CastExpr::CK_NullToMemberPointer);
+ ImpCastExprToType(rex, lType,
+ lType->isMemberPointerType()
+ ? CastExpr::CK_NullToMemberPointer
+ : CastExpr::CK_IntegralToPointer);
return ResultTy;
}
if (LHSIsNull &&
(rType->isPointerType() ||
(!isRelational && rType->isMemberPointerType()))) {
- ImpCastExprToType(lex, rType, CastExpr::CK_NullToMemberPointer);
+ ImpCastExprToType(lex, rType,
+ rType->isMemberPointerType()
+ ? CastExpr::CK_NullToMemberPointer
+ : CastExpr::CK_IntegralToPointer);
return ResultTy;
}
More information about the cfe-commits
mailing list