case 1: and case 2: are labels; switch(mode) is an implicit goto to the appropriate label.
The presence of labels and jumps do not change the scope and object life-time rules of the language. vector<tree> object must be destroyed at the end of the switch-case construct (when it goes out of scope).
But a jump to case 2: would bypass the construction ofthe vector<tree> object. Therefore, the program is ill-formed and the compiler emits the diagnostic:
jump to case label crosses initialization of 'std::vector<tree> huff
thank you for answer me the question
but I still have some confusions
1.
do you mean that "vector<tree> huffman" do not have a destructor
if it has one, what is it?
2.
I should never declare object that don't have a destructor in a switch-case scope