Move the null pointer constant check from Sema::CheckSingleInitializer/ActOnCallExpr/CheckMessageArgumentTypes/ActOnReturnStmt to Sema::CheckSingleAssignmentConstraints. This makes sure all null pointer assignments are considered compatible.
Thanks to Seo Sanghyeon for the bug, follow-through, and patch!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44366 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index e50fe11..8ecbd7c 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -391,13 +391,9 @@
Init->getSourceRange());
return true;
case PointerFromInt:
- // check for null pointer constant (C99 6.3.2.3p3)
- if (!Init->isNullPointerConstant(Context)) {
- Diag(loc, diag::ext_typecheck_assign_pointer_int,
- DeclType.getAsString(), rhsType.getAsString(),
- Init->getSourceRange());
- return true;
- }
+ Diag(loc, diag::ext_typecheck_assign_pointer_int,
+ DeclType.getAsString(), rhsType.getAsString(),
+ Init->getSourceRange());
break;
case IntFromPointer:
Diag(loc, diag::ext_typecheck_assign_pointer_int,