[cfe-commits] r91157 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaObjCXX/standard-conversion-to-bool.mm
Fariborz Jahanian
fjahanian at apple.com
Fri Dec 11 13:23:13 PST 2009
Author: fjahanian
Date: Fri Dec 11 15:23:13 2009
New Revision: 91157
URL: http://llvm.org/viewvc/llvm-project?rev=91157&view=rev
Log:
Consider conversion of objective-c pointer to 'bool' a
valid standard conversion to match g++'s behaviour.
Added:
cfe/trunk/test/SemaObjCXX/standard-conversion-to-bool.mm
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=91157&r1=91156&r2=91157&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Dec 11 15:23:13 2009
@@ -674,7 +674,7 @@
} else if (ToType->isBooleanType() &&
(FromType->isArithmeticType() ||
FromType->isEnumeralType() ||
- FromType->isPointerType() ||
+ FromType->isAnyPointerType() ||
FromType->isBlockPointerType() ||
FromType->isMemberPointerType() ||
FromType->isNullPtrType())) {
Added: cfe/trunk/test/SemaObjCXX/standard-conversion-to-bool.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/standard-conversion-to-bool.mm?rev=91157&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjCXX/standard-conversion-to-bool.mm (added)
+++ cfe/trunk/test/SemaObjCXX/standard-conversion-to-bool.mm Fri Dec 11 15:23:13 2009
@@ -0,0 +1,12 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+ at class NSString;
+id a;
+NSString *b;
+
+void f() {
+ bool b1 = a;
+ bool b2 = b;
+}
+
+
More information about the cfe-commits
mailing list