Bug 3618 – Can't call constructor on immutable/const struct

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-12-15T16:08:00Z
Last change time
2015-06-09T01:27:02Z
Assigned to
nobody
Creator
tomeksowi

Comments

Comment #0 by tomeksowi — 2009-12-15T16:08:25Z
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.
Comment #1 by yebblies — 2011-06-07T04:43:30Z
Fixed since dmd2.041