[cfe-commits] r158931 - in /cfe/trunk: lib/Sema/SemaChecking.cpp test/SemaCXX/conversion.cpp
David Blaikie
dblaikie at gmail.com
Thu Jun 21 11:51:10 PDT 2012
Author: dblaikie
Date: Thu Jun 21 13:51:10 2012
New Revision: 158931
URL: http://llvm.org/viewvc/llvm-project?rev=158931&view=rev
Log:
PR13165: False positive when initializing member data pointers with NULL.
This now correctly covers, I believe, all the pointer types:
* 'any' pointers (both function and data normal pointers and ObjC object pointers)
* member pointers (both function and data)
* block pointers
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/SemaCXX/conversion.cpp
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=158931&r1=158930&r2=158931&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Jun 21 13:51:10 2012
@@ -4432,8 +4432,7 @@
if ((E->isNullPointerConstant(S.Context, Expr::NPC_ValueDependentIsNotNull)
== Expr::NPCK_GNUNull) && !Target->isAnyPointerType()
- && !Target->isBlockPointerType() && !Target->isFunctionPointerType()
- && !Target->isMemberFunctionPointerType()) {
+ && !Target->isBlockPointerType() && !Target->isMemberPointerType()) {
SourceLocation Loc = E->getSourceRange().getBegin();
if (Loc.isMacroID())
Loc = S.SourceMgr.getImmediateExpansionRange(Loc).first;
Modified: cfe/trunk/test/SemaCXX/conversion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/conversion.cpp?rev=158931&r1=158930&r2=158931&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/conversion.cpp (original)
+++ cfe/trunk/test/SemaCXX/conversion.cpp Thu Jun 21 13:51:10 2012
@@ -90,6 +90,14 @@
;
do ;
while(NULL_COND(true));
+ int *ip = NULL;
+ int (*fp)() = NULL;
+ struct foo {
+ int n;
+ void func();
+ };
+ int foo::*datamem = NULL;
+ int (foo::*funmem)() = NULL;
}
namespace test4 {
More information about the cfe-commits
mailing list