Bug? A template mixin inside class makes the dtor of class being invoked 3 times
thesys
shaoyoushi at gmail.com
Sat Jul 19 07:12:28 PDT 2008
hi,
I got sth wrong with D 1.033. Is there a bug?
It's the source code compiled with dmd 1.033
-------------------------------------------------------------------------
extern (C) int printf(char *, ...);
class Bar
{
this()
{
printf("Bar.this()\n");
}
~this()
{
printf("Bar.~this()\n");
}
mixin Foo;
};
template Foo()
{
}
int main(char[][] args)
{
scope Bar bar = new Bar();
return 0;
}
--------------------------------------------------------------------
But the output is:
--------------------------------------------------------------------
Bar.this()
Bar.~this()
Bar.~this()
Bar.~this()
-------------------------------------------------------------------
The dtor of class Bar was invoked 3 times. Why?
More information about the Digitalmars-d
mailing list