On Sat, 2019-01-05 at 10:31 +0000, Nicholas Wilson via Digitalmars-d-learn wrote: […] > > Maybe it is a problem with copying a File_Ptr (e.g. missing a > increase of the reference count)? Like, `auto a = File_Ptr(); { > auto b = a; }` and b calls the destructor on scope exit. > That would be consistent with having problems copying to object > to pass to writeln.
I found the problem and then two minutes later read your email and bingo we have found the problem. Previously I had used File_Ptr* and on this occasion I was using File_Ptr and there was no copy constructor because I have @disable this(this). Except that clearly copying a value is not copying a value in this case. Clearly this situation is what is causing the destructor to be called on an unconstructed value. But I have no idea why. The question now, of course, is should I have been using File_Ptr instead of File_Ptr* in the first place. I am beginning to think I should have been. More thinking needed. -- Russel. =========================================== Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
signature.asc
Description: This is a digitally signed message part