https://issues.dlang.org/show_bug.cgi?id=19763
Issue ID: 19763 Summary: Cannot construct immutable struct from pure mutable struct Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: d...@me.com The following example fails to compile: struct Foo { const(char)* filename; this(const(char)*) pure { } } void main() { immutable a = Foo(null); } Error: cannot implicitly convert expression `Foo(null).this(null)` of type `Foo` to `immutable(Foo)` But this code compiles: struct Foo { const(char)* filename; this(const(char)*) pure { } } Foo newFoo() pure { return Foo(null); } void main() { immutable a = newFoo(); } Also if "const(char)* filename" is changed to "char* filename" the first example compiles. --