https://issues.dlang.org/show_bug.cgi?id=622

RazvanN <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #4 from RazvanN <[email protected]> ---
This issue would may be solved in 2 ways:

1. Issue a warning whenever you have an initialized class reference.

This is not a valid solution because you may want an initialized class
reference that you will use later to point to another class instance.

2. Implement a dataflow analysis mechanism that will track all uses of f.

This is against dmd's principle of not doing complex dataflow analysis. Even it
we were to implement this, there would still be situations were you cannot be
sure whether you are dereferencing a null pointer:

class Foo
{
    int a;
}

void fun(Foo a);

void main()
{
    Foo f;
    fun(f);
    f.a;   // => cannot know what fun did to a.
}

In addition, this sort of access violation is extremely easy to solve because
you get a stack trace. Having a warning pointing it out is really redundant.

Closing as WONTFIX.

--

Reply via email to