Consider conversion of objective-c pointer to 'bool' a
valid standard conversion to match g++'s behaviour.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91157 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 522272e..e498c71 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -674,7 +674,7 @@
} else if (ToType->isBooleanType() &&
(FromType->isArithmeticType() ||
FromType->isEnumeralType() ||
- FromType->isPointerType() ||
+ FromType->isAnyPointerType() ||
FromType->isBlockPointerType() ||
FromType->isMemberPointerType() ||
FromType->isNullPtrType())) {
diff --git a/test/SemaObjCXX/standard-conversion-to-bool.mm b/test/SemaObjCXX/standard-conversion-to-bool.mm
new file mode 100644
index 0000000..d1e212c
--- /dev/null
+++ b/test/SemaObjCXX/standard-conversion-to-bool.mm
@@ -0,0 +1,12 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+@class NSString;
+id a;
+NSString *b;
+
+void f() {
+ bool b1 = a;
+ bool b2 = b;
+}
+
+