digitalmars.D.bugs - [Issue 22639] New: Copy constructors with default arguments not
- d-bugmail puremagic.com (42/42) Dec 30 2021 https://issues.dlang.org/show_bug.cgi?id=22639
https://issues.dlang.org/show_bug.cgi?id=22639 Issue ID: 22639 Summary: Copy constructors with default arguments not getting called Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: scienticman gmail.com ``` import std.stdio:writeln; struct A { this(ref return scope A rhs) inout {} this(ref return scope const A rhs, int b = 7) inout { if (b != 7) { this.b = b; } } this(this) disable; int a=4; int b=3; } void main() { A a = A(); //A c = A(a,10); // Doesn't work :( /+ A c = void; c.__ctor(a, 200); //works if I write like this +/ A* b = new A(a, 10); //But this works! writeln(b.b); writeln(c.b); } ``` --
Dec 30 2021