зеркало из https://github.com/microsoft/clang-1.git
Support conversion from a null pointer constant o any Objective-C object pointer type. Fixes rdar://problem/6463298
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61340 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
669e8d3c6a
Коммит
27b09ac9f7
|
@ -767,6 +767,13 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
|
|||
if (isObjCPointerConversion(FromType, ToType, ConvertedType, IncompatibleObjC))
|
||||
return true;
|
||||
|
||||
// Conversion from a null pointer constant to any Objective-C pointer type.
|
||||
if (Context.isObjCObjectPointerType(ToType) &&
|
||||
From->isNullPointerConstant(Context)) {
|
||||
ConvertedType = ToType;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Blocks: Block pointers can be converted to void*.
|
||||
if (FromType->isBlockPointerType() && ToType->isPointerType() &&
|
||||
ToType->getAsPointerType()->getPointeeType()->isVoidType()) {
|
||||
|
|
|
@ -76,6 +76,9 @@ void qualid_test(A *a, B *b, C *c) {
|
|||
int& i1 = qualid(a);
|
||||
int& i2 = qualid(b);
|
||||
float& f1 = qualid(c);
|
||||
|
||||
id<P0> p1 = 0;
|
||||
p1 = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче