April 08, 2019 [Issue 19795] New: Constructor from template mixin cannot be called when default constructor is disabled | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19795 Issue ID: 19795 Summary: Constructor from template mixin cannot be called when default constructor is disabled Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: yshuiv7@gmail.com Example: mixin template A() { this(string z) { x = z.length;} } class Y { ulong x; mixin A; @disable this(); } void main() { auto y = new Y("asdf"); } This generates error: <source>(12): Error: constructor `example.Y.this()` is not callable using argument types `(string)` <source>(12): expected 0 argument(s), not 1 Whereas this compiles fine: class Y { ulong x; this(string z) { x = z.length;} } void main() { auto y = new Y("asdf"); } -- |
Copyright © 1999-2021 by the D Language Foundation