Boost logo

Boost Users :

Subject: [Boost-users] [Phoenix] boost::phoenix::erase crashes the app in VS2008
From: Paul Heil (paul.heil_at_[hidden])
Date: 2012-06-14 14:17:30


I have a Visual Studio 2008 C++03 application where I'm using
boost::phoenix::erase (v1.49.0) on a std::list<int> container that does not
contain the element I want to erase.

This example is demonstrates the issue:

    int main()
    {
        namespace bp = boost::phoenix;
        namespace bpa = boost::phoenix::arg_names;

        std::list< int > a;

        // works as expected (does nothing)
        a.erase( a.end(), a.end() );

        // fails a debug assertion "list erase iterator outside range"
        // Microsoft Visual Studio 9.0\VC\include\list\list : 790
        bp::erase( bp::ref( a ), a.end() )();

        return 0;
    }

In release mode, this de-references an uninitialized pointer and the
application crashes. Am I using boost::phoenix::erase correctly?

Thanks



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net