public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "schaub.johannes at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/49372] New: Temporaries evaluated for arguments of a default constructors of array elements not destructed properly (?) Date: Sat, 11 Jun 2011 13:27:00 -0000 [thread overview] Message-ID: <bug-49372-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49372 Summary: Temporaries evaluated for arguments of a default constructors of array elements not destructed properly (?) Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: schaub.johannes@googlemail.com This testcase outputs a surprising result: struct A { A() { std::cout << "C" << std::endl; } ~A() { std::cout << "D" << std::endl; } }; struct B { B(A const& a = A()) { } }; typedef B array[2]; int main() { array{}; } GCC prints "CCDD". I would have expected "CDCD", as it seems that is the intent of the wording in the spec (FDIS). The FDIS however seems to be contradicting here, but it appears to me that GCC should better print "CDCD", so as to follow the intent. Originated from http://stackoverflow.com/questions/6315670/when-an-array-is-created-by-a-subexpression-what-happens-with-the-temporaries-th .
next reply other threads:[~2011-06-11 13:27 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-11 13:27 schaub.johannes at googlemail dot com [this message] 2011-06-11 13:47 ` [Bug c++/49372] " schaub.johannes at googlemail dot com 2012-12-10 11:07 ` ktietz at gcc dot gnu.org 2012-12-10 13:15 ` redi at gcc dot gnu.org 2012-12-10 13:42 ` ktietz at gcc dot gnu.org 2012-12-10 16:43 ` schaub.johannes at googlemail dot com 2023-05-08 12:58 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-49372-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).