bool disposed = false; auto disposable = new RefCountDisposable(new AnonymousDisposable({ disposed = true; })); auto subscription = disposable.getDisposable(); assert(!disposed); disposable.dispose(); assert(!disposed); subscription.dispose(); assert(disposed);