if (pushed) margins->push(margins->left() + t->style->margin[HD_POS_LEFT], margins->right() - t->style->margin[HD_POS_RIGHT], margins->bottom(), 0);
parse_contents(t->child, margins, y, page, heading, chap);
if (pushed) margins->pop(); break;
Reason: The problem is that there is a declaration of an object (the boolean "pushed") without scope. Thus, the scope of the object could traverse the break statement and apply to the next case. Consider this - what is the scope of obj1 in the code below? It starts at the first label, and goes until the end of the case block. So it's in scope at CHOICE_B. But its constructor wasn't called....
Code:
switch (choice) { case CHOICE_A: someclass obj1(&commonobj);
break; case CHOICE_B: someotherclass obj2(&commonobj);
break; default: break; } }
Thus, you should use curly brackets to delimit scope, as in:
Code:
switch (choice) { case A: { someobj x; ... } break; case B: { ... } break; ... }