From stdcxx-dev-return-3627-apmail-incubator-stdcxx-dev-archive=incubator.apache.org@incubator.apache.org Tue Jun 05 14:19:57 2007 Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 3846 invoked from network); 5 Jun 2007 14:19:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jun 2007 14:19:52 -0000 Received: (qmail 33990 invoked by uid 500); 5 Jun 2007 14:19:51 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 33929 invoked by uid 500); 5 Jun 2007 14:19:51 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 33856 invoked by uid 99); 5 Jun 2007 14:19:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2007 07:19:51 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2007 07:19:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7CACE71419E for ; Tue, 5 Jun 2007 07:19:26 -0700 (PDT) Message-ID: <8077015.1181053166508.JavaMail.jira@brutus> Date: Tue, 5 Jun 2007 07:19:26 -0700 (PDT) From: "Farid Zaripov (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Closed: (STDCXX-331) std::list::insert() violates strong exception safety requirements In-Reply-To: <5902528.1170325805494.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Farid Zaripov closed STDCXX-331. -------------------------------- The test suite already have the test cases to detect this bug. Actually the bug was found after running the 23.list.insert test. > std::list::insert() violates strong exception safety requirements > ----------------------------------------------------------------- > > Key: STDCXX-331 > URL: https://issues.apache.org/jira/browse/STDCXX-331 > Project: C++ Standard Library > Issue Type: Bug > Components: 23. Containers > Affects Versions: 4.1.3 > Environment: All > Reporter: Farid Zaripov > Assignee: Farid Zaripov > Fix For: 4.2 > > > The list::insert() method do not satisfy strong exception safety requirements (23.2.3.3 Remark 1). > Details are here: > http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200701.mbox/%3c45C0C705.8040606@kyiv.vdiweb.com%3e > test.cpp: > ------------------------------ > #include > #include > static int throw_inx = -1; > class ListItem > { > public: > static int count_; > void test () > { > if (throw_inx == count_) > throw count_; > ++count_; > } > ListItem () { test (); } > ListItem (const ListItem&) { test (); } > ~ListItem () { --count_; } > }; > int ListItem::count_ = 0; > int main (int argc, char* argv[]) > { > typedef std::list List; > ListItem items [20]; > List lst (1); > bool thrown = false; > throw_inx = 10; > List::iterator it = lst.begin (); > ListItem & ref = *it; > try { > ListItem::count_ = 0; > lst.insert (it, 20, items [0]); > } catch (...) { > thrown = true; > } > assert (thrown); > assert (it == lst.begin ()); > assert (&ref == &*lst.begin ()); > assert (1 == lst.size ()); > assert (0 == ListItem::count_); > try { > ListItem::count_ = 0; > lst.insert (it, items, items + 20); > } catch (...) { > thrown = true; > } > assert (thrown); > assert (it == lst.begin ()); > assert (&ref == &*lst.begin ()); > assert (1 == lst.size ()); > assert (0 == ListItem::count_); > return 0; > } > The test output: > ------------------------------ > test: /usr/src/tests/test.cpp:48: int main(int, char**): Assertion `it == lst.begin ()' failed. > Aborted. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.