You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Farid Zaripov (JIRA)" <ji...@apache.org> on 2007/02/07 16:23:05 UTC

[jira] Created: (STDCXX-334) std::list::swap does not swap containers with defferent allocator correctly

std::list::swap does not swap containers with defferent allocator correctly
---------------------------------------------------------------------------

                 Key: STDCXX-334
                 URL: https://issues.apache.org/jira/browse/STDCXX-334
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 23. Containers
    Affects Versions: 4.1.3
         Environment: All
            Reporter: Farid Zaripov


The program below fails:

---------------------------------------------
#include <list>
#include <string>
#include <cassert>

class Alloc : public std::allocator <char>
{
};

bool operator == (Alloc a1, Alloc a2)
{
    return false;
}

bool operator != (Alloc a1, Alloc a2)
{
    return true;
}

int main(int argc, char* argv[])
{
    const char src [] = "source string";
    const char dst [] = "destination string";

    typedef std::list <char, Alloc> List;
    
    Alloc a1;
    Alloc a2;

    assert (!(a1 == a2));

    List src_lst (src, src + sizeof (src) - 1, a1);
    List dst_lst (dst, dst + sizeof (dst) - 1, a2);

    src_lst.swap (dst_lst);

    assert (std::string (src_lst.begin (), src_lst.end ()) == dst);
    assert (std::string (dst_lst.begin (), dst_lst.end ()) == src);

    return 0;
}

---------------------------------------------

Assertion failed: std::string (dst_lst.begin (), dst_lst.end ()) == src, file swap.cpp, line 37

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (STDCXX-334) std::list::swap does not swap containers with different allocators correctly

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov resolved STDCXX-334.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2

Fixed thus: http://svn.apache.org/viewvc?view=rev&revision=504581

> std::list::swap does not swap containers with different allocators correctly
> ----------------------------------------------------------------------------
>
>                 Key: STDCXX-334
>                 URL: https://issues.apache.org/jira/browse/STDCXX-334
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 23. Containers
>    Affects Versions: 4.1.3
>         Environment: All
>            Reporter: Farid Zaripov
>             Fix For: 4.2
>
>
> The program below fails:
> ---------------------------------------------
> #include <list>
> #include <string>
> #include <cassert>
> class Alloc : public std::allocator <char>
> {
> };
> bool operator == (Alloc a1, Alloc a2)
> {
>     return false;
> }
> bool operator != (Alloc a1, Alloc a2)
> {
>     return true;
> }
> int main(int argc, char* argv[])
> {
>     const char src [] = "source string";
>     const char dst [] = "destination string";
>     typedef std::list <char, Alloc> List;
>     
>     Alloc a1;
>     Alloc a2;
>     assert (!(a1 == a2));
>     List src_lst (src, src + sizeof (src) - 1, a1);
>     List dst_lst (dst, dst + sizeof (dst) - 1, a2);
>     src_lst.swap (dst_lst);
>     assert (std::string (src_lst.begin (), src_lst.end ()) == dst);
>     assert (std::string (dst_lst.begin (), dst_lst.end ()) == src);
>     return 0;
> }
> ---------------------------------------------
> Assertion failed: std::string (dst_lst.begin (), dst_lst.end ()) == src, file swap.cpp, line 37
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (STDCXX-334) std::list::swap does not swap containers with different allocators correctly

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov closed STDCXX-334.
--------------------------------


The regression test added thus: http://svn.apache.org/viewvc?view=rev&rev=544786


> std::list::swap does not swap containers with different allocators correctly
> ----------------------------------------------------------------------------
>
>                 Key: STDCXX-334
>                 URL: https://issues.apache.org/jira/browse/STDCXX-334
>             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 program below fails:
> ---------------------------------------------
> #include <list>
> #include <string>
> #include <cassert>
> class Alloc : public std::allocator <char>
> {
> };
> bool operator == (Alloc a1, Alloc a2)
> {
>     return false;
> }
> bool operator != (Alloc a1, Alloc a2)
> {
>     return true;
> }
> int main(int argc, char* argv[])
> {
>     const char src [] = "source string";
>     const char dst [] = "destination string";
>     typedef std::list <char, Alloc> List;
>     
>     Alloc a1;
>     Alloc a2;
>     assert (!(a1 == a2));
>     List src_lst (src, src + sizeof (src) - 1, a1);
>     List dst_lst (dst, dst + sizeof (dst) - 1, a2);
>     src_lst.swap (dst_lst);
>     assert (std::string (src_lst.begin (), src_lst.end ()) == dst);
>     assert (std::string (dst_lst.begin (), dst_lst.end ()) == src);
>     return 0;
> }
> ---------------------------------------------
> Assertion failed: std::string (dst_lst.begin (), dst_lst.end ()) == src, file swap.cpp, line 37
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (STDCXX-334) std::list::swap does not swap containers with different allocators correctly

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor reassigned STDCXX-334:
-----------------------------------

    Assignee: Farid Zaripov

Assigning to Farid -- please close this after adding the test to our regression test suite.

> std::list::swap does not swap containers with different allocators correctly
> ----------------------------------------------------------------------------
>
>                 Key: STDCXX-334
>                 URL: https://issues.apache.org/jira/browse/STDCXX-334
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 23. Containers
>    Affects Versions: 4.1.3
>         Environment: All
>            Reporter: Farid Zaripov
>         Assigned To: Farid Zaripov
>             Fix For: 4.2
>
>
> The program below fails:
> ---------------------------------------------
> #include <list>
> #include <string>
> #include <cassert>
> class Alloc : public std::allocator <char>
> {
> };
> bool operator == (Alloc a1, Alloc a2)
> {
>     return false;
> }
> bool operator != (Alloc a1, Alloc a2)
> {
>     return true;
> }
> int main(int argc, char* argv[])
> {
>     const char src [] = "source string";
>     const char dst [] = "destination string";
>     typedef std::list <char, Alloc> List;
>     
>     Alloc a1;
>     Alloc a2;
>     assert (!(a1 == a2));
>     List src_lst (src, src + sizeof (src) - 1, a1);
>     List dst_lst (dst, dst + sizeof (dst) - 1, a2);
>     src_lst.swap (dst_lst);
>     assert (std::string (src_lst.begin (), src_lst.end ()) == dst);
>     assert (std::string (dst_lst.begin (), dst_lst.end ()) == src);
>     return 0;
> }
> ---------------------------------------------
> Assertion failed: std::string (dst_lst.begin (), dst_lst.end ()) == src, file swap.cpp, line 37
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (STDCXX-334) std::list::swap does not swap containers with different allocators correctly

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov updated STDCXX-334:
---------------------------------

    Summary: std::list::swap does not swap containers with different allocators correctly  (was: std::list::swap does not swap containers with defferent allocator correctly)

> std::list::swap does not swap containers with different allocators correctly
> ----------------------------------------------------------------------------
>
>                 Key: STDCXX-334
>                 URL: https://issues.apache.org/jira/browse/STDCXX-334
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 23. Containers
>    Affects Versions: 4.1.3
>         Environment: All
>            Reporter: Farid Zaripov
>
> The program below fails:
> ---------------------------------------------
> #include <list>
> #include <string>
> #include <cassert>
> class Alloc : public std::allocator <char>
> {
> };
> bool operator == (Alloc a1, Alloc a2)
> {
>     return false;
> }
> bool operator != (Alloc a1, Alloc a2)
> {
>     return true;
> }
> int main(int argc, char* argv[])
> {
>     const char src [] = "source string";
>     const char dst [] = "destination string";
>     typedef std::list <char, Alloc> List;
>     
>     Alloc a1;
>     Alloc a2;
>     assert (!(a1 == a2));
>     List src_lst (src, src + sizeof (src) - 1, a1);
>     List dst_lst (dst, dst + sizeof (dst) - 1, a2);
>     src_lst.swap (dst_lst);
>     assert (std::string (src_lst.begin (), src_lst.end ()) == dst);
>     assert (std::string (dst_lst.begin (), dst_lst.end ()) == src);
>     return 0;
> }
> ---------------------------------------------
> Assertion failed: std::string (dst_lst.begin (), dst_lst.end ()) == src, file swap.cpp, line 37
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.