namespace js { class StackIter { enum State { DONE, SCRIPTED, NATIVE, ION }; State state_; void popFrame(); void popCall(); void popIonFrame(); StackIter &operator++(); }; } using namespace js; StackIter & StackIter::operator++() { switch (state_) { case DONE: __builtin_unreachable(); case SCRIPTED: popFrame(); case NATIVE: popCall(); case ION: popIonFrame(); } return *this; }