cat > bug.d << CODE import core.sync.mutex : Mutex; class MyMutex : Mutex { } CODE dmd -c -o- bug ---- /home/dawg/Code/D/bug.d(3): Error: core.sync.mutex.Mutex.__ctor called with argument types () matches both: /home/dawg/dlang/dmd-master-2017-01-28/linux/bin64/../../src/druntime/import/core/sync/mutex.di(21): core.sync.mutex.Mutex.this() and: /home/dawg/dlang/dmd-master-2017-01-28/linux/bin64/../../src/druntime/import/core/sync/mutex.di(25): core.sync.mutex.Mutex.this() /home/dawg/Code/D/bug.d(3): Error: class bug.MyMutex cannot implicitly generate a default ctor when base class core.sync.mutex.Mutex is missing a default ctor ---- Introduced by https://github.com/dlang/druntime/issues/1728 or https://github.com/dlang/druntime/issues/1726. This is arguable a dmd bug, but it easily breaks any Mutex sub-class right now.
Currently breaks vibe.d and a couple of projects on ci.dawg.eu.
This indeed looks like a compiler bug. If the base class has multiple default constructors, the compiler should synthesize multiple default constructors in the derived class. I.e. the base class and the derived class should have equivalent default constructor overload sets. BTW, the code in question can be easily be worked around like this: class MyMutex : Mutex { this() { super(); } } Though the following did not work: class MyMutex : Mutex { this() { } } Error: core.sync.mutex.Mutex.__ctor called with argument types () matches both: druntime/import/core/sync/mutex.di(21): core.sync.mutex.Mutex.this() and: druntime/import/core/sync/mutex.di(25): core.sync.mutex.Mutex.this() bug.d(5):
I'll have a look at fixing the compiler implementation later today.
https://github.com/dlang/dmd/pull/6513
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/db81df0b6db19f5808e551a01730c15d341dc981 fix Issue 17130 - ambiguous implicit super call - need type of this to resolve base class ctor overloads https://github.com/dlang/dmd/commit/5262d78df2d2b4b3ee1fffc3393a5d57b535a481 Merge pull request #6513 from MartinNowak/fix17130 fix Issue 17130 - ambiguous implicit super call
Reopening because even though this was fixed: class MyMutex : Mutex { this() // OK after https://github.com/dlang/dmd/pull/6513 { } } the OP issue is still there: class MyMutex : Mutex { // NG } bug.d(3): Error: core.sync.mutex.Mutex.__ctor called with argument types () matches both: /home/zombinedev/code/repos/dlang/druntime/import/core/sync/mutex.di(21): core.sync.mutex.Mutex.this() and: /home/zombinedev/code/repos/dlang/druntime/import/core/sync/mutex.di(25): core.sync.mutex.Mutex.this() bug.d(3): Error: class mutex_attr.MyMutex cannot implicitly generate a default ctor when base class core.sync.mutex.Mutex is missing a default ctor
https://github.com/dlang/dmd/pull/6541
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/cfeb41ae8db207d708b48155760a52dba0c57791 fix Issue 17130 - ambiguous implicit super call - need to pass class type to resolveFuncCall - also make implicit ctor shared for shared base ctor https://github.com/dlang/dmd/commit/69182dac5d7e4ba0f32377715f24ccf910d2f333 Merge pull request #6541 from MartinNowak/fix17130 fix Issue 17130 - ambiguous implicit super call
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/db81df0b6db19f5808e551a01730c15d341dc981 fix Issue 17130 - ambiguous implicit super call https://github.com/dlang/dmd/commit/5262d78df2d2b4b3ee1fffc3393a5d57b535a481 Merge pull request #6513 from MartinNowak/fix17130 https://github.com/dlang/dmd/commit/cfeb41ae8db207d708b48155760a52dba0c57791 fix Issue 17130 - ambiguous implicit super call https://github.com/dlang/dmd/commit/69182dac5d7e4ba0f32377715f24ccf910d2f333 Merge pull request #6541 from MartinNowak/fix17130
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/db81df0b6db19f5808e551a01730c15d341dc981 fix Issue 17130 - ambiguous implicit super call https://github.com/dlang/dmd/commit/5262d78df2d2b4b3ee1fffc3393a5d57b535a481 Merge pull request #6513 from MartinNowak/fix17130 https://github.com/dlang/dmd/commit/cfeb41ae8db207d708b48155760a52dba0c57791 fix Issue 17130 - ambiguous implicit super call https://github.com/dlang/dmd/commit/69182dac5d7e4ba0f32377715f24ccf910d2f333 Merge pull request #6541 from MartinNowak/fix17130