Proposed resolution (10/00: Change text in Clause 14 [except] paragraph 2 from: (See also issue 246.)A goto , break , return , or
continue statement
can be used to transfer control out of a try block or handler, but not
into one.
to:
A goto or switch statement shall not be used
to transfer control into a try block or into a handler.
[ Example:
void f() {
—end example ]
goto l1; // Ill-formed
goto l2; // Ill-formed
try {
goto l1; // OK
goto l2; // Ill-formed
l1: ;
} catch (...) {
l2: ;
goto l1; // Ill-formed
goto l2; // OK
}
}
A goto , break , return , or continue
statement can be used to transfer control out of a try block or handler.
At the top of clause 15, in paragraph 2, it says: Consider:
A goto , break , return , or continue statement can be used to transfer
control out of a try block or handler, but not into one.
What about switch statements?
switch ( f() )
{
case 1:
try {
g();
case 2:
h();
}
catch (...)
{
// handler
}
break;
}
Daveed Vandevoorde:
void f() {
try {
label:
;
} catch(...) {
goto label;
}
}
Now the phrase "try block" (without a hyphen) is used in paragraph
1 in a way that causes me to think that it is not intended to
include the corresponding handlers. On the other hand, the grammar
entity "try-block" (with hyphen) does include the handlers.
So is the intent to prohibit the above or not?