Bug 19795 – Constructor from template mixin cannot be called when default constructor is disabled

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-04-08T23:12:33Z
Last change time
2023-04-18T14:11:05Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Yuxuan Shui

Comments

Comment #0 by yshuiv7 — 2019-04-08T23:12:33Z
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"); }
Comment #1 by razvan.nitu1305 — 2023-04-18T14:11:05Z
This a duplicate of 3332 *** This issue has been marked as a duplicate of issue 3332 ***