www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3618] New: Can't call constructor on immutable/const struct

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: tomeksowi gmail.com



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: -------
Dec 15 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3618


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |FIXED



Fixed since dmd2.041

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