Skip to content

Some unclear wording in [except] CWG2775 #5238

Closed
@xmh0511

Description

@xmh0511

[except.throw] p3

Throwing an exception copy-initializes ([dcl.init], [class.copy.ctor]) a temporary object, called the exception object.

The sentence does not specify the source of the copy-initialization. A possible improvement maybe that

Throwing an exception copy-initializes ([dcl.init], [class.copy.ctor]) a temporary object, called the exception object, from the operand of the throw-expression.

[except.throw] p2

When an exception is thrown, control is transferred to the nearest handler with a matching type ([except.handle]); “nearest” means the handler for which the compound-statement or ctor-initializer following the try keyword was most recently entered by the thread of control and not yet exited.

Is the following an improvement to the definition of "nearest handler"?

“nearest” means the handler of a try-block or function-try-block whose compound-statement or ctor-initializer was most recently entered by the thread of control and not yet exited.

The improvement seems to be simpler to read.

[except.throw] p5

When the thrown object is a class object, the constructor selected for the copy-initialization as well as the constructor selected for a copy-initialization considering the thrown object as an lvalue shall be non-deleted and accessible, even if the copy/move operation is elided ([class.copy.elision]). The destructor is potentially invoked ([class.dtor]).

"thrown object" seems not to be a formal wording. Because we have defined exception object. Isn't that better to be used instead of "thrown object"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    cwgIssue must be reviewed by CWG.not-editorialIssue is not deemed editorial; the editorial issue is kept open for tracking.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions