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

           Summary: Pure function cannot call struct constructor
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: tomeks...@gmail.com


--- Comment #0 from Tomasz SowiƄski <tomeks...@gmail.com> 2009-11-29 03:19:44 
PST ---
struct A {
    float f;
    this (float f) {
        this.f = f;
    }
    static pure A stworz(float f) {
        return A(f);
    }
}

The above doesn't compile:
Error: pure function 'stworz' cannot call impure function 'this'

What's interesting, if stworz signature is one of the below:

static pure stworz(float f);
static pure auto stworz(float f);

then it merrily compiles. So it's sth about the explicit return type.

If I remove the constructor, it also compiles.
If A is a class, it also compiles.

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

Reply via email to