aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-07 13:36:37 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-07 13:36:37 +0000
commit443c21266f189ed48c32cadf72c463e9b992b3eb (patch)
tree99ba8f48bd3ab2a9a1f3e9ce344ca3eac243e3e4 /lib/Sema/SemaExpr.cpp
parent59c451ef236ec5af8fecc7291f5cb87a3ea6e799 (diff)
Integral-to-pointer conversions are not always null -> member pointer
conversions. Fixes PR7443. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110519 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 920c235945..96ac69c7ff 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -5598,13 +5598,19 @@ QualType Sema::CheckCompareOperands(Expr *&lex, Expr *&rex, SourceLocation Loc,
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;
}