PR14284: crash on ext-valid returning NULL from a void function

llvm-svn: 167565
This commit is contained in:
David Blaikie 2012-11-08 00:41:20 +00:00
parent c56bd08373
commit a1edff0046
2 changed files with 4 additions and 1 deletions

View File

@ -4799,7 +4799,8 @@ void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
if ((E->isNullPointerConstant(S.Context, Expr::NPC_ValueDependentIsNotNull)
== Expr::NPCK_GNUNull) && !Target->isAnyPointerType()
&& !Target->isBlockPointerType() && !Target->isMemberPointerType()) {
&& !Target->isBlockPointerType() && !Target->isMemberPointerType()
&& Target->isScalarType()) {
SourceLocation Loc = E->getSourceRange().getBegin();
if (Loc.isMacroID())
Loc = S.SourceMgr.getImmediateExpansionRange(Loc).first;

View File

@ -90,4 +90,6 @@ void f() {
b = e == NULL || NULL == e || e != NULL || NULL != e;
b = f == NULL || NULL == f || f != NULL || NULL != f;
b = "f" == NULL || NULL == "f" || "f" != NULL || NULL != "f";
return NULL; // expected-error{{void function 'f' should not return a value}}
}