On 8/2/12, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote: > Make it 'auto' and it might just work. :p struct box { T opCast(T : bool)() { static T state; state = !state; return state; } static auto open() { return typeof(this)(); } } void main() { auto alive = box.open(); assert(alive && !alive); }