cpp/language/goto

Transfers control unconditionally.

Used when it is otherwise impossible to transfer control to the desired location using other statements.

Explanation
The goto statement transfers control to the location specified by. The goto statement must be in the same function as the it is referring, it may appear before or after the label.

If transfer of control exits the scope of any automatic variables (e.g. by jumping backwards to a point before the declarations of such variables or by jumping forward out of a compound statement where the variables are scoped), the destructors are called for all variables whose scope was exited, in the order opposite to the order of their construction.

The statement cannot transfer control into a  or into a catch-clause, but can transfer control out of a try-block or a catch-clause (the rules above regarding automatic variables in scope are followed).

If transfer of control enters the scope of any automatic variables (e.g. by jumping forward over a declaration statement), the program is ill-formed (cannot be compiled), unless all variables whose scope is entered have @1@ scalar types declared without initializers @2@ class types with trivial default constructors and trivial destructors declared without initializers @3@ cv-qualified versions of one of the above @4@ arrays of one of the above

(Note: the same rules apply to all forms of transfer of control)