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/SemaStmt.cpp b/Sema/SemaStmt.cpp
index d051f6b..d00501a 100644
--- a/Sema/SemaStmt.cpp
+++ b/Sema/SemaStmt.cpp
@@ -617,12 +617,9 @@
RetValExp->getSourceRange());
break;
case PointerFromInt:
- // check for null pointer constant (C99 6.3.2.3p3)
- if (!RetValExp->isNullPointerConstant(Context)) {
- Diag(ReturnLoc, diag::ext_typecheck_return_pointer_int,
- lhsType.getAsString(), rhsType.getAsString(),
- RetValExp->getSourceRange());
- }
+ Diag(ReturnLoc, diag::ext_typecheck_return_pointer_int,
+ lhsType.getAsString(), rhsType.getAsString(),
+ RetValExp->getSourceRange());
break;
case IntFromPointer:
Diag(ReturnLoc, diag::ext_typecheck_return_pointer_int,