https://issues.dlang.org/show_bug.cgi?id=23681
RazvanN <razvan.nitu1...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1...@gmail.com Resolution|--- |DUPLICATE --- Comment #1 from RazvanN <razvan.nitu1...@gmail.com> --- When the copy constructor for Depender is generated it looks like: this(ref inout Depender src) inout { this.dependency = dependency; } However, this.dependency = dependency is rewritten to this.dependency.copyCtor(dependency); which cannot be called because it is mutable and we are using inout objects. Therefore the cpctor is marked as disable. The destructor of Dependency causes the compiler to generate an opAssign with the signature "ref Dependency opAssign(Dependency src)". The existence of this assignment operator causes Depender (which contains a Dependency) to also define an opAssign which receives the argument by value. That is where the generated (and disabled) copy constructor is called. This is another effect of what I described here: https://issues.dlang.org/show_bug.cgi?id=20876#c4 . Fixing 20876 to correctly generate more accurate copy constructors will also fix this. Another approach would be to stop generating assignment operators based on copy constructors and destructors. *** This issue has been marked as a duplicate of issue 20876 *** --