http://d.puremagic.com/issues/show_bug.cgi?id=10013
Summary: `inout` constructor sometimes fails to create
immutable object
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Denis Shelomovskij <[email protected]> 2013-04-30
16:34:45 MSD ---
---
class C
{
this() inout { }
this(inout int[]) inout { }
}
void main()
{
auto c0 = new immutable C(cast(immutable int[]) null); // OK
auto c1 = new immutable C(); // Error (line 10)
auto c2 = new immutable C(null); // Error (line 11)
}
---
dmd output:
---
main.d(10): Error: inout constructor main.C.this creates inout object, not
immutable
main.d(11): Error: inout constructor main.C.this creates mutable object, not
immutable
---
Partial workaround:
Mark constructor as `pure` or `immutable` if possible.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------