[Issue 3569] DMD Stack Overflow with a struct member function inside a C-style struct initializer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 3 13:54:15 PST 2009


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



--- Comment #1 from Rob Jacques <sandford at jhu.edu> 2009-12-03 13:54:14 PST ---
The cause of the stack overflow may be due to the C style initializers being
incorrectly (correctly?) evaluated at compile time:

i.e.:
struct Foo {
    float opMul(float b) { return b; }
}

struct Bar {
    Foo foo;
    Bar opMul(float b) {
        Bar r = {foo*b};
        return r;
    }
}

generates the errors:
Error: variable b is used before initialization
Error: cannot evaluate this.foo.opMul(b) at compile time
Error: cannot implicitly convert expression (this.foo.opMul(b)) of type float
to Foo
Error: cannot evaluate this.foo.opMul(b) at compile time

-- 
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