Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
November 13, 2006 [Issue 499] New: Multiple overrides of the destructor when using signals | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=499 Summary: Multiple overrides of the destructor when using signals Product: D Version: 0.173 Platform: PC OS/Version: Windows Status: NEW Severity: blocker Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: maxter@i.com.ua The following gives 'test.d(233): function test.Test.Signal!(Args)._dtor multiple overrides of same function': import std.stdio, std.signals; class Args { int foo; } class Base { ~this() { writefln("Base dtor!"); } } class Test : Base { mixin Signal!(Args) A; mixin Signal!(Args) B; ~this() { writefln("Test dtor"); } } void main() { auto test = new Test; } //------------------------------ The code compiles ok, if there is no base class or no destructor in the base class. -- |
November 13, 2006 Re: [Issue 499] New: Multiple overrides of the destructor when using signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | d-bugmail@puremagic.com wrote: > http://d.puremagic.com/issues/show_bug.cgi?id=499 > > Summary: Multiple overrides of the destructor when using signals > Product: D > Version: 0.173 > Platform: PC > OS/Version: Windows > Status: NEW > Severity: blocker > Priority: P2 > Component: DMD > AssignedTo: bugzilla@digitalmars.com > ReportedBy: maxter@i.com.ua > > > The following gives 'test.d(233): function test.Test.Signal!(Args)._dtor > multiple overrides of same function': > > import std.stdio, std.signals; > > class Args > { > int foo; > } > > class Base > { > ~this() > { > writefln("Base dtor!"); > } > } > > class Test : Base > { > mixin Signal!(Args) A; > mixin Signal!(Args) B; > > ~this() > { > writefln("Test dtor"); > } > } > > > void main() > { > auto test = new Test; > } > > //------------------------------ > > The code compiles ok, if there is no base class or no destructor in the base > class. > > This is already fixed in the version of std.signals here: http://www.digitalmars.com/d/phobos/signals.d --bb |
November 13, 2006 Re: [Issue 499] New: Multiple overrides of the destructor when using signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | On Tue, 14 Nov 2006 02:05:36 +0900, Bill Baxter <wbaxter@gmail.com> wrote:
>d-bugmail@puremagic.com wrote:
>> http://d.puremagic.com/issues/show_bug.cgi?id=499
>>
>> Summary: Multiple overrides of the destructor when using signals
>> Product: D
>> Version: 0.173
>> Platform: PC
>> OS/Version: Windows
>> Status: NEW
>> Severity: blocker
>> Priority: P2
>> Component: DMD
>> AssignedTo: bugzilla@digitalmars.com
>> ReportedBy: maxter@i.com.ua
>>
>>
>> The following gives 'test.d(233): function test.Test.Signal!(Args)._dtor
>> multiple overrides of same function':
>>
>> import std.stdio, std.signals;
>>
>> class Args
>> {
>> int foo;
>> }
>>
>> class Base
>> {
>> ~this()
>> {
>> writefln("Base dtor!");
>> }
>> }
>>
>> class Test : Base
>> {
>> mixin Signal!(Args) A;
>> mixin Signal!(Args) B;
>>
>> ~this()
>> {
>> writefln("Test dtor");
>> }
>> }
>>
>>
>> void main()
>> {
>> auto test = new Test;
>> }
>>
>> //------------------------------
>>
>> The code compiles ok, if there is no base class or no destructor in the base class.
>>
>>
>
>This is already fixed in the version of std.signals here: http://www.digitalmars.com/d/phobos/signals.d
>
>--bb
It's not. The problem is not with signals but with mixed in destructors
template TDtor()
{
~this()
{
writefln("Mixed-in dtor");
}
}
class Base
{
~this()
{
writefln("Base dtor");
}
}
class Test : Base
{
mixin TDtor A;
mixin TDtor B;
~this()
{
writefln("Test dtor");
}
}
void main()
{
auto test = new Test;
}
If i get it right, this should compile and output:
Test dtor
Mixed-in dtor
Mixed-in dtor
Base dtor
|
November 13, 2006 Re: [Issue 499] New: Multiple overrides of the destructor when using signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Samuha | Max Samuha wrote:
> On Tue, 14 Nov 2006 02:05:36 +0900, Bill Baxter <wbaxter@gmail.com>
> wrote:
>
>
>>d-bugmail@puremagic.com wrote:
>>
>>>http://d.puremagic.com/issues/show_bug.cgi?id=499
>>>
>>> Summary: Multiple overrides of the destructor when using signals
>>> Product: D
>>> Version: 0.173
>>> Platform: PC
>>> OS/Version: Windows
>>> Status: NEW
>>> Severity: blocker
>>> Priority: P2
>>> Component: DMD
>>> AssignedTo: bugzilla@digitalmars.com
>>> ReportedBy: maxter@i.com.ua
>>>
>>>
>>>The following gives 'test.d(233): function test.Test.Signal!(Args)._dtor
>>>multiple overrides of same function':
>>>
>>>import std.stdio, std.signals;
>>>
>>>class Args
>>>{
>>> int foo;
>>>}
>>>
>>>class Base
>>>{
>>> ~this()
>>> {
>>> writefln("Base dtor!");
>>> }
>>>}
>>>
>>>class Test : Base
>>>{
>>> mixin Signal!(Args) A;
>>> mixin Signal!(Args) B;
>>>
>>> ~this()
>>> {
>>> writefln("Test dtor");
>>> }
>>>}
>>>
>>>
>>>void main()
>>>{
>>> auto test = new Test;
>>>}
>>>
>>>//------------------------------
>>>
>>>The code compiles ok, if there is no base class or no destructor in the base
>>>class.
>>>
>>>
>>
>>This is already fixed in the version of std.signals here:
>>http://www.digitalmars.com/d/phobos/signals.d
>>
>>--bb
>
>
> It's not. The problem is not with signals but with mixed in
> destructors
>
> template TDtor()
> {
> ~this()
> {
> writefln("Mixed-in dtor");
> }
> }
>
> class Base
> {
> ~this()
> {
> writefln("Base dtor");
> }
> }
>
> class Test : Base
> {
> mixin TDtor A;
> mixin TDtor B;
>
> ~this()
> {
> writefln("Test dtor");
> }
> }
>
> void main()
> {
> auto test = new Test;
> }
>
> If i get it right, this should compile and output:
>
> Test dtor
> Mixed-in dtor
> Mixed-in dtor
> Base dtor
>
Ah, I see. Try moving your destrutor before the mixins.
--bb
|
November 14, 2006 Re: [Issue 499] New: Multiple overrides of the destructor when using signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | On Tue, 14 Nov 2006 04:54:04 +0900, Bill Baxter <wbaxter@gmail.com> wrote:
>
>Ah, I see. Try moving your destrutor before the mixins.
>
>--bb
It works, thanks. But the bug should be fixed anyway
|
November 17, 2006 [Issue 499] Multiple overrides of the destructor when using signals | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=499 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #5 from bugzilla@digitalmars.com 2006-11-17 05:20 ------- Fixed DMD 0.174 -- |
Copyright © 1999-2021 by the D Language Foundation