C++ Logo


Advanced search

Re: Wording about lifetime seems to be defective for parameter objects

From: Brian Bi <bbi5291_at_[hidden]>
Date: Mon, 24 Jun 2019 12:14:13 -0500
On Thu, Jun 13, 2019 at 1:03 PM Brian Bi <bbi5291_at_[hidden]> wrote:

> [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?
> --
> *Brian Bi*

The subject line was incorrect on my previous message in this thread. Sorry
about that.

I suppose I'll file a DR since nobody pointed out any reason why I

*Brian Bi*

Received on 2019-06-24 12:16:17