Date: Thu, 13 Jun 2019 13:03:21 -0500
[class.dtor]/12 says: "A destructor is invoked implicitly ... for a
constructed object with automatic storage duration (6.7.3) when the block
in which an object is created exits (9.7), ..."
This appears to imply that a parameter object should be destroyed when the
block *containing the call* is exited, since the object is created in the
calling context.
Yet the intended rule for destruction of parameter objects is in
[expr.call]/4: "... It is implementation-defined whether the lifetime of a
parameter ends when the function in which it is defined returns or at the
end of the enclosing full-expression. ..."
This seems to suggest to me that either [class.dtor]/12 should be amended
with an exception for parameter objects, or that function parameters have a
special storage duration which is not quite the same as automatic storage
duration.
Should I file a defect report for this?
constructed object with automatic storage duration (6.7.3) when the block
in which an object is created exits (9.7), ..."
This appears to imply that a parameter object should be destroyed when the
block *containing the call* is exited, since the object is created in the
calling context.
Yet the intended rule for destruction of parameter objects is in
[expr.call]/4: "... It is implementation-defined whether the lifetime of a
parameter ends when the function in which it is defined returns or at the
end of the enclosing full-expression. ..."
This seems to suggest to me that either [class.dtor]/12 should be amended
with an exception for parameter objects, or that function parameters have a
special storage duration which is not quite the same as automatic storage
duration.
Should I file a defect report for this?
-- *Brian Bi*
Received on 2019-06-13 13:05:22