aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-16 18:52:05 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-16 18:52:05 +0000
commit16cd4b744ada95eedeca6d90702739f0262309d4 (patch)
treef6734d8effadf80fd931baaec661d90de5849e98 /lib
parent707a23e8b87410332b55bb4534fa1c799edef38a (diff)
Allow comparison between block pointers and NULL pointer
constants. Fixes PR10145. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExpr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 5e30e7179c..76612cd6d8 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -7772,7 +7772,8 @@ QualType Sema::CheckCompareOperands(ExprResult &lex, ExprResult &rex, SourceLoca
// comparisons of member pointers to null pointer constants.
if (RHSIsNull &&
((lType->isAnyPointerType() || lType->isNullPtrType()) ||
- (!isRelational && lType->isMemberPointerType()))) {
+ (!isRelational &&
+ (lType->isMemberPointerType() || lType->isBlockPointerType())))) {
rex = ImpCastExprToType(rex.take(), lType,
lType->isMemberPointerType()
? CK_NullToMemberPointer
@@ -7781,7 +7782,8 @@ QualType Sema::CheckCompareOperands(ExprResult &lex, ExprResult &rex, SourceLoca
}
if (LHSIsNull &&
((rType->isAnyPointerType() || rType->isNullPtrType()) ||
- (!isRelational && rType->isMemberPointerType()))) {
+ (!isRelational &&
+ (rType->isMemberPointerType() || rType->isBlockPointerType())))) {
lex = ImpCastExprToType(lex.take(), rType,
rType->isMemberPointerType()
? CK_NullToMemberPointer