1 class Klazz
2 {
3     __gshared size_t count;
~this()4     ~this()
5     {
6         ++count;
7     }
8 }
9 
main()10 void main()
11 {
12     auto s = new Klazz;
13     {
14         scope s2 = s; // calls delete even though it does not own s
15     }
16     assert(Klazz.count == 0);
17 }
18