Return-Path: Delivered-To: apmail-stdcxx-issues-archive@minotaur.apache.org Received: (qmail 38430 invoked from network); 14 Aug 2009 16:39:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Aug 2009 16:39:39 -0000 Received: (qmail 5623 invoked by uid 500); 14 Aug 2009 16:39:46 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 5595 invoked by uid 500); 14 Aug 2009 16:39:46 -0000 Mailing-List: contact issues-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list issues@stdcxx.apache.org Received: (qmail 5564 invoked by uid 99); 14 Aug 2009 16:39:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Aug 2009 16:39:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Aug 2009 16:39:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id D7186234C045 for ; Fri, 14 Aug 2009 09:39:14 -0700 (PDT) Message-ID: <593815947.1250267954880.JavaMail.jira@brutus> Date: Fri, 14 Aug 2009 09:39:14 -0700 (PDT) From: "Farid Zaripov (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Commented: (STDCXX-1037) Bug in vector::swap() with unequal allocators In-Reply-To: <68988306.1249394114982.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-1037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743283#action_12743283 ] Farid Zaripov commented on STDCXX-1037: --------------------------------------- The regression test is added thus: http://svn.apache.org/viewvc?view=rev&revision=804283 > Bug in vector::swap() with unequal allocators > --------------------------------------------- > > Key: STDCXX-1037 > URL: https://issues.apache.org/jira/browse/STDCXX-1037 > Project: C++ Standard Library > Issue Type: Bug > Components: 23. Containers > Affects Versions: 4.1.3, 4.1.4, 4.2.0, 4.2.1 > Environment: All > Reporter: Farid Zaripov > Assignee: Farid Zaripov > Priority: Minor > Fix For: 4.2.2 > > Original Estimate: 1h > Remaining Estimate: 1h > > The test below fails with assertion: > {noformat} > Assertion failed: 1 == v1.size() && 2 == v1.front(), file test.cpp, line 32 > This application has requested the Runtime to terminate it in an unusual way. > Please contact the application's support team for more information. > {noformat} > {code:title=test.cpp} > #include > #include > #include > template > class Alloc : public std::allocator > { > public: > Alloc(int i) : i_(i) { } > int i_; > }; > template > bool operator==(const Alloc& a1, const Alloc& a2) > { > return a1.i_ == a2.i_; > } > int main () > { > std::vector > v1(Alloc(1)); > v1.push_back(1); > assert(1 == v1.size() && 1 == v1.front()); > std::vector > v2(Alloc(2)); > v2.push_back(2); > assert(1 == v2.size() && 2 == v2.front()); > v1.swap(v2); > assert(1 == v1.size() && 2 == v1.front()); > assert(1 == v2.size() && 1 == v2.front()); > return 0; > } > {code} > The bug was introduced in [r355174|http://svn.apache.org/viewvc?view=rev&revision=355174] > The proposed patch: > {code:title=vector.cc.diff} > Index: vector.cc > =================================================================== > --- vector.cc (revision 800774) > +++ vector.cc (working copy) > @@ -133,6 +133,7 @@ > _RWSTD_ASSERT (__tmp.get_allocator () == __other.get_allocator ()); > > __tmp.assign (begin (), end ()); > + assign (__other.begin (), __other.end ()); > __other.swap (__tmp); > } > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.