praveenvvstgy / crack-language

Automatically exported from code.google.com/p/crack-language
Other
0 stars 0 forks source link

calling methods from base/class member constructor causes problems. #118

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

class A {
    int x, y;
    int f() {
        y = 100;
        return 200;
    }

    oper init() : x = f() {}
}

A a = {};
printint(a.y);

What is the expected output? What do you see instead?
the value of y gets overwritten by zero.  This is particularly bad in the case 
of a member that is an object.   

Please use labels and text to provide additional information.

Original issue reported on code.google.com by mind...@gmail.com on 9 Dec 2012 at 6:31