[Issue 4906] Dereferencing null error in a single expression

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 9 09:11:04 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4906


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-09 09:11:03 PST ---
(In reply to comment #0)
> To find null dereferencing in code the compiler probably needs to perform flow
> analysis.
> But the compiler can spot and flag as errors at compile-time expressions that
> follow explicit comparisons to null:
> 
> 
> if (obj is null && obj.foo()) { ...

What if 'foo' is a UFCS function? There's a slight possibility that such a
check was expected. I guess the compiler could be more lax in the UFCS case and
more careful if 'foo' is actually a method, so maybe this is implementable..

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list