auto scope problem
Jarrett Billingsley
kb3ctd2 at yahoo.com
Tue Dec 4 12:23:48 PST 2007
"Koroskin Denis" <2korden+digitalmars at gmail.com> wrote in message
news:fj3pbo$ees$1 at digitalmars.com...
> Of course no,
> class Test
> {
> public:
> this()
> {
> printf("constructed\n");
> }
>
> ~this()
> {
> printf("deleted\n");
> }
> }
>
> int main(char[][] args)
> {
> {
> auto/scope Test t = new Test();
> }
>
> printf("exit main\n");
> return 0;
> }
>
> Both auto and scope give just the same result:
> "constructed, deleted, exit main"
I believe you've found a bug :\
If you use any of the following:
scope Test t = new Test();
scope t = new Test();
auto Test t = new Test();
it uses RAII, but it shouldn't for the last case. Notice:
Test t = new Test();
auto t = new Test();
_do not_ use RAII as expected.
That "auto Test t" seems to be a bug. Probably been there for ages.
More information about the Digitalmars-d-bugs
mailing list