Topic: Defect Report: [stmt.jump]/2 refers to temporaries that have a declaration
Author: gennaro_prota@yahoo.com (Gennaro Prota)
Date: Mon, 9 Sep 2002 17:37:02 +0000 (UTC) Raw View
{To the moderator: Unforgivably, resolution b) in the previous
submission was simply stupid :-(. Is it possible to replace the old DR
with this one? Thank you very much, and my apologies for the error}
Paragraph 6.6/2 of the standard says:
"On exit from a scope (however accomplished), destructors (12.4)
are called for all constructed objects with automatic storage
duration (3.7.2) (named objects or temporaries) that are declared
in that scope"
It refers to objects "that are declared" but the text in parenthesis
also mentions temporaries, which cannot be declared. I think that text
should be removed.
Genny.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: francis.glassborow@ntlworld.com (Francis Glassborow)
Date: Mon, 9 Sep 2002 18:52:58 +0000 (UTC) Raw View
In article <jqnmnuk86kkcb1okvd5hg51tsbrg4h6qg1@4ax.com>, Gennaro Prota
<gennaro_prota@yahoo.com> writes
>
>{To the moderator: Unforgivably, resolution b) in the previous
>submission was simply stupid :-(. Is it possible to replace the old DR
>with this one? Thank you very much, and my apologies for the error}
>
>Paragraph 6.6/2 of the standard says:
>
> "On exit from a scope (however accomplished), destructors (12.4)
> are called for all constructed objects with automatic storage
> duration (3.7.2) (named objects or temporaries) that are declared
> in that scope"
>
>It refers to objects "that are declared" but the text in parenthesis
>also mentions temporaries, which cannot be declared. I think that text
>should be removed.
The wording is poor but we have to allow for destruction of temporaries
that are bound to a const ref that was declared in that scope (the
others will have been destroyed at the end of the complete expression in
which they were constructed.)
--
Francis Glassborow ACCU
64 Southfield Rd
Oxford OX4 1PA +44(0)1865 246490
All opinions are mine and do not represent those of any organisation
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: gennaro_prota@yahoo.com (Gennaro Prota)
Date: Tue, 10 Sep 2002 01:04:23 +0000 (UTC) Raw View
On Mon, 9 Sep 2002 18:52:58 +0000 (UTC),
francis.glassborow@ntlworld.com (Francis Glassborow) wrote:
[...]
>>
>>Paragraph 6.6/2 of the standard says:
>>
>> "On exit from a scope (however accomplished), destructors (12.4)
>> are called for all constructed objects with automatic storage
>> duration (3.7.2) (named objects or temporaries) that are declared
>> in that scope"
>>
>>It refers to objects "that are declared" but the text in parenthesis
>>also mentions temporaries, which cannot be declared. I think that text
>>should be removed.
>
>The wording is poor but we have to allow for destruction of temporaries
>that are bound to a const ref that was declared in that scope (the
>others will have been destroyed at the end of the complete expression in
>which they were constructed.)
But the text is still incorrect. Those temporaries are not declared.
One could think that the paragraph applies to the reference (which is
declared) and that the destruction of the reference "causes" the
destruction of the temporary but there's the problem that references
are not objects (thus BTW even the notion of "destruction of a
reference" is probably incorrect). In short, the sentence with "named
objects or temporaries" removed doesn't require destruction of the
temporaries; but even with the phrase it doesn't apply either to the
references or to the bound temporaries. So a correction is needed
anyhow.
Genny.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: Gennaro Prota <gennaro_prota@yahoo.com>
Date: 7 Sep 2002 22:11:55 GMT Raw View
[moderator's note: forwarded to C++ Commitee. -sdc]
Paragraph 6.6/2 of the standard says:
"On exit from a scope (however accomplished), destructors (12.4)
are called for all constructed objects with automatic storage
duration (3.7.2) (named objects or temporaries) that are declared
in that scope"
It refers to objects "that are declared" but the text in parenthesis
also mentions temporaries, which cannot be declared. I see at least
two possible resolutions:
a) simply removing the text "(named objects or temporaries)"
b) replacing that text with "named or unnamed" and move it ahead in
the sentence. This way:
"On exit from a scope (however accomplished), destructors (12.4)
are called for all constructed objects [insert: (named or
unnamed)] with automatic storage duration (3.7.2) [remove: (named
objects or temporaries)] that are declared in that scope"
Optionally, a note or a link to 9.5/2 ([class.union]/2) can be added
to clarify what the adjective unnamed is alluding to.
Genny.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]