From 0e704f7fcdf3231cf5b6ae7e758b74e47c3a9c05 Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 18 May 2010 09:35:29 +0000 Subject: Permit Objective C object pointers to be const_casted. llvm-svn: 104019 --- clang/lib/Sema/SemaCXXCast.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaCXXCast.cpp') diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp index 1dbdd06eeab..c8eae2fb0a8 100644 --- a/clang/lib/Sema/SemaCXXCast.cpp +++ b/clang/lib/Sema/SemaCXXCast.cpp @@ -983,7 +983,9 @@ static TryCastResult TryConstCast(Sema &Self, Expr *SrcExpr, QualType DestType, // C++ 5.2.11p5: For a const_cast involving pointers to data members [...] // the rules for const_cast are the same as those used for pointers. - if (!DestType->isPointerType() && !DestType->isMemberPointerType()) { + if (!DestType->isPointerType() && + !DestType->isMemberPointerType() && + !DestType->isObjCObjectPointerType()) { // Cannot cast to non-pointer, non-reference type. Note that, if DestType // was a reference type, we converted it to a pointer above. // The status of rvalue references isn't entirely clear, but it looks like -- cgit v1.2.3