[Issue 3618] New: Can't call constructor on immutable/const struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 15 16:08:26 PST 2009


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

           Summary: Can't call constructor on immutable/const struct
           Product: D
           Version: 2.036
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tomeksowi at gmail.com


--- Comment #0 from Tomasz Sowiński <tomeksowi at gmail.com> 2009-12-15 16:08:25 PST ---
I have problems when using an explicit constructor with structs. It manifests
itself when creating a stack variable.

immutable struct Strukt {
    this(int pole) { this.pole = pole; }
    int pole;
}

void main() {
    auto nowy = new Strukt(6);  // OK
    auto s = Strukt(8);     // Error: constructor test.Strukt.this (int pole)
is not callable using argument types (int) immutable
}

Same story for const. Side note: If you take off immutable/const, it compiles.

Looks similar to Bug 2610.

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