[cfe-commits] r133179 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaObjCXX/nullptr.mm
Douglas Gregor
dgregor at apple.com
Thu Jun 16 11:52:05 PDT 2011
Author: dgregor
Date: Thu Jun 16 13:52:05 2011
New Revision: 133179
URL: http://llvm.org/viewvc/llvm-project?rev=133179&view=rev
Log:
Allow comparison between block pointers and NULL pointer
constants. Fixes PR10145.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaObjCXX/nullptr.mm
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=133179&r1=133178&r2=133179&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jun 16 13:52:05 2011
@@ -7772,7 +7772,8 @@
// 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 @@
}
if (LHSIsNull &&
((rType->isAnyPointerType() || rType->isNullPtrType()) ||
- (!isRelational && rType->isMemberPointerType()))) {
+ (!isRelational &&
+ (rType->isMemberPointerType() || rType->isBlockPointerType())))) {
lex = ImpCastExprToType(lex.take(), rType,
rType->isMemberPointerType()
? CK_NullToMemberPointer
Modified: cfe/trunk/test/SemaObjCXX/nullptr.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/nullptr.mm?rev=133179&r1=133178&r2=133179&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/nullptr.mm (original)
+++ cfe/trunk/test/SemaObjCXX/nullptr.mm Thu Jun 16 13:52:05 2011
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++0x -fblocks -fsyntax-only -verify %s
@interface A
@end
@@ -11,3 +11,6 @@
void assignment(A *a) {
a = nullptr;
}
+
+int PR10145a = (void(^)())0 == nullptr;
+int PR10145b = nullptr == (void(^)())0;
More information about the cfe-commits
mailing list