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
An expression E is potentially-throwing if [...] E implicitly invokes a function (such as an overloaded operator, an allocation function in a new-expression, a constructor for a function argument, or a destructor if E is a full-expression) that has a potentially-throwing exception specification [...]
While this is just a list of examples, it can be read as suggesting that the exception specification of a destructor only contributes to whether an expression is potentially-throwing if the expression is a full-expression. But that's not correct -- the expression delete p should consider the destructor of the type of *p (assuming it's a class type and doesn't have a destroying operator delete) regardless of whether it's a full-expression. Also, per [expr.call]/6, parameters in a function call may be destroyed when the call returns rather than at the end of the full-expression.
Also... do we ever even query whether a non-full expression is potentially-throwing? (The definition of potentially-throwing recurses to subexpressions.) The operand of noexcept is a full-expression, and I'd hope we take destructors of temporaries into account in all the other places we use the term!
Suggestion: delete the "if E is a full-expression".
The text was updated successfully, but these errors were encountered:
[except.spec]/5:
While this is just a list of examples, it can be read as suggesting that the exception specification of a destructor only contributes to whether an expression is potentially-throwing if the expression is a full-expression. But that's not correct -- the expression
delete p
should consider the destructor of the type of*p
(assuming it's a class type and doesn't have a destroying operator delete) regardless of whether it's a full-expression. Also, per [expr.call]/6, parameters in a function call may be destroyed when the call returns rather than at the end of the full-expression.Also... do we ever even query whether a non-full expression is potentially-throwing? (The definition of potentially-throwing recurses to subexpressions.) The operand of
noexcept
is a full-expression, and I'd hope we take destructors of temporaries into account in all the other places we use the term!Suggestion: delete the "if E is a full-expression".
The text was updated successfully, but these errors were encountered: