Boost C++ Libraries: Ticket #5875: local variable in phoenix let discards value https://svn.boost.org/trac10/ticket/5875 <p> In the following test case, the size of the vector is zero, while it should be three as that's what the vector is constructed with. </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#include</span> <span class="cpf">&lt;boost/phoenix.hpp&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;iostream&gt;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&lt;vector&gt;</span><span class="cp"></span> <span class="k">namespace</span> <span class="n">phx</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">phoenix</span><span class="p">;</span> <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">v</span> <span class="o">=</span> <span class="n">phx</span><span class="o">::</span><span class="n">let</span><span class="p">(</span><span class="n">phx</span><span class="o">::</span><span class="n">local_names</span><span class="o">::</span><span class="n">_a</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="p">(</span><span class="mi">3</span><span class="p">))</span> <span class="p">[</span> <span class="n">phx</span><span class="o">::</span><span class="n">local_names</span><span class="o">::</span><span class="n">_a</span> <span class="p">]</span> <span class="p">();</span> <span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="n">v</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><p> If the local is used in a non-trivial way in the let block, the vector will be properly initialized. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5875 Trac 1.4.3 John Fletcher <J.P.Fletcher@…> Sat, 01 Feb 2014 18:03:16 GMT <link>https://svn.boost.org/trac10/ticket/5875#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5875#comment:1</guid> <description> <p> This bug is now fixed by other changes. Test bug5875 installed as a check. </p> </description> <category>Ticket</category> </item> <item> <author>John Fletcher <J.P.Fletcher@…></author> <pubDate>Sun, 02 Feb 2014 21:10:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5875#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5875#comment:2</guid> <description> <p> The test bug5875 is failing with crashes on a number of compilers, but not any which I have available. I would be grateful for any information on this. In the meantime I will leave it on develop to get more information but will not post the test to master. </p> <p> I have not made any changes to phoenix for this at all. </p> </description> <category>Ticket</category> </item> <item> <author>John Fletcher <J.P.Fletcher@…></author> <pubDate>Sun, 02 Feb 2014 21:44:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5875#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5875#comment:3</guid> <description> <p> I have withdrawn test bug5875 from develop for more testing offline. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Kohei Takahashi</dc:creator> <pubDate>Mon, 09 May 2016 14:52:01 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5875#comment:4 https://svn.boost.org/trac10/ticket/5875#comment:4 <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> Works fine now. <a class="ext-link" href="http://melpon.org/wandbox/permlink/DkDO0A9fIgYUzZ41"><span class="icon">​</span>http://melpon.org/wandbox/permlink/DkDO0A9fIgYUzZ41</a> </p> Ticket