This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49372] Temporaries evaluated for arguments of a default constructors of array elements not destructed properly (?)
- From: "ktietz at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Dec 2012 13:42:30 +0000
- Subject: [Bug c++/49372] Temporaries evaluated for arguments of a default constructors of array elements not destructed properly (?)
- Auto-submitted: auto-generated
- References: <bug-49372-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49372
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |NEW
Last reconfirmed| |2012-12-10
Resolution|INVALID |
Ever Confirmed|0 |1
--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-12-10 13:42:30 UTC ---
(In reply to comment #3)
> Kai, I don't think anyone disputes that B's constructor is called, the question
> is why 12.2/4 doesn't apply.
Well, we have here 5.2.2 which says "A function call is a postfix expression
followed by parentheses containing a possibly empty, comma-separated list of
expressions which constitute the arguments to the function."
But we don't have here an explicit function-call. And an implicit call is not
an expression, hence, not a part of any full expression, and so we don't have a
sequence-point. Not sure if specification intended it differently, but by its
current wording I would assume that current implementation is right.
But indeed 12.4 seems to be violated here. "There are two contexts in which
temporaries are destroyed at a different point than the end of the
fullexpression.
The first context is when a default constructor is called to initialize an
element of an array. If the constructor has one or more default arguments, the
destruction of every temporary created in a default argument expression is
sequenced before the construction of the next array element, if any."
So there is an antagonism in spec. I will reopen it. sorry, didn't read about
12.4