Boost C++ Libraries: Ticket #7356: program crashed when using phoenix::switch_,case<> with STL::for_each, using std::vector<int> as the container https://svn.boost.org/trac10/ticket/7356 <p> Problem: the program is listed as bellow, complied with mingw32-gcc-4.6.2, enabling std++0x. The program is OK when running in debug model, but crashed in release mode. The error code is -1073741819. </p> <p> #include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;algorithm&gt; #include &lt;boost/phoenix.hpp&gt; </p> <p> using namespace std; using namespace boost; using phoenix::placeholders::arg1; </p> <p> int main() { </p> <blockquote> <p> vector&lt;int&gt; vec = {1, 2, 3, 4, 5, 6, 7, 8, 9}; </p> </blockquote> <blockquote> <p> for_each(vec.begin(), vec.end(), </p> <blockquote> <p> switch_(arg1) [ </p> <blockquote> <p> phoenix::case_&lt;1&gt;(cout &lt;&lt; phoenix::val("One") &lt;&lt; '\n'), phoenix::case_&lt;2&gt;(cout &lt;&lt; phoenix::val("Two") &lt;&lt; '\n'), phoenix::default_(cout &lt;&lt; phoenix::val("other value") &lt;&lt; '\n') </p> </blockquote> <p> ]); </p> </blockquote> <p> return 0; </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7356 Trac 1.4.3 viboes Tue, 18 Sep 2012 16:57:34 GMT component changed; owner set https://svn.boost.org/trac10/ticket/7356#comment:1 https://svn.boost.org/trac10/ticket/7356#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Thomas Heller</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">phoenix</span> </li> </ul> Ticket Eric Niebler Sun, 30 Dec 2012 19:00:13 GMT <link>https://svn.boost.org/trac10/ticket/7356#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7356#comment:2</guid> <description> <p> See also: <a class="ext-link" href="http://stackoverflow.com/questions/14063880/why-does-this-proto-phoenix-toy-example-crash"><span class="icon">​</span>http://stackoverflow.com/questions/14063880/why-does-this-proto-phoenix-toy-example-crash</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Kohei Takahashi</dc:creator> <pubDate>Tue, 10 May 2016 14:35:58 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7356#comment:3 https://svn.boost.org/trac10/ticket/7356#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> 1.52 fixes this issue. <a class="ext-link" href="http://melpon.org/wandbox/permlink/iwweR1lSD3MPLEQD"><span class="icon">​</span>http://melpon.org/wandbox/permlink/iwweR1lSD3MPLEQD</a> </p> <p> Note: 1.51 crashes. <a class="ext-link" href="http://melpon.org/wandbox/permlink/FaOhgX1NXUbC2o4H"><span class="icon">​</span>http://melpon.org/wandbox/permlink/FaOhgX1NXUbC2o4H</a> </p> Ticket