August 17, 2020 [Issue 21170] New: Can not instantiate a class instance using inout constructor. | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21170 Issue ID: 21170 Summary: Can not instantiate a class instance using inout constructor. Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: alexandru.ermicioi@gmail.com Kinda silly that you can't create mutable/immutable objects using inout constructor. For some reason const one works. Example: ----- import std; class Silly { this() inout { } } void main() { auto s = new Silly(); auto cs = new const Silly(); auto iss = new immutable Silly(); } ----- Error: ----- onlineapp.d(10): Error: inout constructor onlineapp.Silly.this creates inout object, not mutable onlineapp.d(12): Error: inout constructor onlineapp.Silly.this creates inout object, not immutable ----- Expected: first & second error to not be at all here, since those are also part of inout constructor's job. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply