[Issue 19795] New: Constructor from template mixin cannot be called when default constructor is disabled
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 8 23:12:33 UTC 2019
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 at puremagic.com
Reporter: yshuiv7 at 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");
}
--
More information about the Digitalmars-d-bugs
mailing list