Bug 17130 – [Reg 2.074] ambiguous implicit super call when inheriting core.sync.mutex.Mutex
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-01-30T16:47:00Z
Last change time
2017-03-22T12:21:29Z
Keywords
pull
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2017-01-30T16:47:40Z
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.
Comment #1 by code — 2017-01-30T17:04:55Z
Currently breaks vibe.d and a couple of projects on ci.dawg.eu.
Comment #2 by petar.p.kirov — 2017-01-31T16:24:06Z
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):
Comment #3 by code — 2017-02-01T14:29:16Z
I'll have a look at fixing the compiler implementation later today.
Comment #6 by petar.p.kirov — 2017-02-12T15:04:53Z
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