[cfe-commits] r45542 - in /cfe/trunk: Sema/SemaExpr.cpp test/Sema/objc-comptypes-8.m
Fariborz Jahanian
fjahanian at apple.com
Thu Jan 3 10:46:54 PST 2008
Author: fjahanian
Date: Thu Jan 3 12:46:52 2008
New Revision: 45542
URL: http://llvm.org/viewvc/llvm-project?rev=45542&view=rev
Log:
Fixed a bug reported by Chris, involving assiging 0 to a qualified object type.
Added:
cfe/trunk/test/Sema/objc-comptypes-8.m
Modified:
cfe/trunk/Sema/SemaExpr.cpp
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=45542&r1=45541&r2=45542&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Thu Jan 3 12:46:52 2008
@@ -1174,7 +1174,8 @@
Sema::CheckSingleAssignmentConstraints(QualType lhsType, Expr *&rExpr) {
// C99 6.5.16.1p1: the left operand is a pointer and the right is
// a null pointer constant.
- if (lhsType->isPointerType() && rExpr->isNullPointerConstant(Context)) {
+ if ((lhsType->isPointerType() || lhsType->isObjcQualifiedIdType())
+ && rExpr->isNullPointerConstant(Context)) {
promoteExprToType(rExpr, lhsType);
return Compatible;
}
Added: cfe/trunk/test/Sema/objc-comptypes-8.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/objc-comptypes-8.m?rev=45542&view=auto
==============================================================================
--- cfe/trunk/test/Sema/objc-comptypes-8.m (added)
+++ cfe/trunk/test/Sema/objc-comptypes-8.m Thu Jan 3 12:46:52 2008
@@ -0,0 +1,12 @@
+// RUN: clang -fsyntax-only %s
+
+ at protocol MyProtocol
+ at end
+
+id<MyProtocol> obj_p = 0;
+
+int main()
+{
+ obj_p = 0;
+}
+
More information about the cfe-commits
mailing list