You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CWG2711 [except.throw] It is not specified what the exception object is copy-initialized from #280
Issue description: As pointed out by user 0x5f3759df on Stack Overflow, the normative wording in [expr.throw] and [except.throw] respectively specify the type of the exception object and the fact that the exception object is copy-initialized, but do not appear to specify that the exception object is copy-initialized from the assignment-expression operand.
Suggested resolution: Edit [except.throw]/3:
Throwing an exceptionA throw-expression ([expr.throw]) with an operand copy-initializes (9.4, 11.4.5.3) a temporary object, called the exception object, from its operand. If the type of the exception object would be an incomplete type, an abstract class type (11.7.4), or a pointer to an incomplete type other than cvvoid the program is ill-formed.
This isn't good; there are situations in the language where we throw exceptions without a throw-expression (for example, a failed dynamic cast or a failed typeid).
We still want to initialize an exception object in these cases.
changed the title [-][except.throw] It is not specified what the exception object is copy-initialized from[/-][+]CWG2711 [except.throw] It is not specified what the exception object is copy-initialized from[/+]on Mar 30, 2023
Activity
jensmaurer commentedon Mar 30, 2023
This isn't good; there are situations in the language where we throw exceptions without a throw-expression (for example, a failed dynamic cast or a failed typeid).
We still want to initialize an exception object in these cases.
jensmaurer commentedon Mar 30, 2023
CWG2711
[-][except.throw] It is not specified what the exception object is copy-initialized from[/-][+]CWG2711 [except.throw] It is not specified what the exception object is copy-initialized from[/+]t3nsor commentedon Mar 30, 2023
Good catch. Thanks for fixing the wording.