aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-05-10 18:38:11 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-05-10 18:38:11 +0000
commit6e8ed16ffef02b82995a90bdcf10ffff7d63839a (patch)
treee493c276b5aea9c425cadfc2d53d0f3dd78fe18d /lib/Sema/SemaOverload.cpp
parent9f2e23e708d3fa7c54f6626cd901993a86e007e6 (diff)
Implement C++0x nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71405 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index e6b8056a42..50330e3f63 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -621,7 +621,8 @@ Sema::IsStandardConversion(Expr* From, QualType ToType,
FromType->isEnumeralType() ||
FromType->isPointerType() ||
FromType->isBlockPointerType() ||
- FromType->isMemberPointerType())) {
+ FromType->isMemberPointerType() ||
+ FromType->isNullPtrType())) {
SCS.Second = ICK_Boolean_Conversion;
FromType = Context.BoolTy;
}
@@ -898,6 +899,13 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
return true;
}
+ // If the left-hand-side is nullptr_t, the right side can be a null
+ // pointer constant.
+ if (ToType->isNullPtrType() && From->isNullPointerConstant(Context)) {
+ ConvertedType = ToType;
+ return true;
+ }
+
const PointerType* ToTypePtr = ToType->getAsPointerType();
if (!ToTypePtr)
return false;