Bear Cherian:

Class MyClass{

    this(){}

    void someFunction(){
        //body
    }

}

And in my app I had something like

    MyClass classObject;
    classObject.someFunction();

When I compile, no warnings or errors.

If you compile that code (with lowercase Class) with -O the compiler finds the bug:



class MyClass {
    this() {}

    void someFunction() {
        //body
    }
}

void main() {
    MyClass classObject;
    classObject.someFunction;
}


test.d(11,5): Error: null dereference in function _Dmain


But in more complex cases the compiler doesn't.

Bye,
bearophile

Reply via email to