Boost C++ Libraries: Ticket #5490: Fusion fails to insulate user-supplied template parameters from unintentional MPL placeholder substitution (?) https://svn.boost.org/trac10/ticket/5490 <p> The code below fails on MSVC9 with Boost 1.43.0, but recent developers' list activity <code>[1]</code> suggests this is still broken in Boost 1.46.1. And, to emphasize, I believe it *should* compile, but I could be wrong there! </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/fusion/algorithm/transformation/transform.hpp&gt; #include &lt;boost/fusion/container/vector/vector10.hpp&gt; #include &lt;boost/fusion/sequence/io/out.hpp&gt; #include &lt;boost/mpl/quote.hpp&gt; #include &lt;boost/mpl/placeholders.hpp&gt; #include &lt;boost/type_traits/is_integral.hpp&gt; template&lt; class &gt; struct foo { typedef int result_type; template&lt; class T &gt; int operator()(const T&amp;) const { return 0; } }; int main() { boost::fusion::vector1&lt; int &gt; v; typedef boost::is_integral&lt; boost::mpl::_1 &gt; mpl_type; // 1 //typedef boost::mpl::quote1&lt; boost::is_integral &gt; mpl_type; // 2 std::cout &lt;&lt; boost::fusion::transform(v, foo&lt; mpl_type &gt;()); return 0; } </pre><p> A workaround is to use "<em> 2" rather than "</em> 1". </p> <p> I believe the proper fix is to insulate any user-supplied template parameters from unintential Boost.MPL placeholder substitution within the implementation of boost::fusion::transform and/or boost::fusion::transform_view, but I haven't looked into where exactly this should occur or how widespread this is. </p> <p> The existence of a workaround together with the probable rarity of the situation likely makes this a low-priority bug, but it is a subtle problem once you run into it. </p> <p> <code>[1]</code> <a class="ext-link" href="http://thread.gmane.org/gmane.comp.lib.boost.devel/218162"><span class="icon">​</span>http://thread.gmane.org/gmane.comp.lib.boost.devel/218162</a> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5490 Trac 1.4.3 Kohei Takahashi <flast@…> Sat, 29 Aug 2015 16:23:01 GMT <link>https://svn.boost.org/trac10/ticket/5490#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5490#comment:1</guid> <description> <p> Does the quoted version (i.e. "2") work as you intended? It instantiate <code>foo&lt;quote1&lt;is_integral&gt;&gt;</code> but not <code>foo&lt;true_&gt;</code> or <code>foo&lt;false_&gt;</code> because <code>foo&lt;is_integral&lt;_1&gt;&gt;</code> and <code>quote1&lt;is_integral&gt;</code> are lambda expression, but <code>foo&lt;quote1&lt;is_integral&gt;&gt;</code> is not. </p> <p> see: <a class="ext-link" href="http://melpon.org/wandbox/permlink/5rAG4sqeTJPcqtDe"><span class="icon">​</span>http://melpon.org/wandbox/permlink/5rAG4sqeTJPcqtDe</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Kohei Takahashi</dc:creator> <pubDate>Fri, 06 Jul 2018 15:51:25 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/5490#comment:2 https://svn.boost.org/trac10/ticket/5490#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Joel de Guzman</span> to <span class="trac-author">Kohei Takahashi</span> </li> </ul> <p> Ahhhh, OK, I understood what you said. The functor of fusion::transform doesn't require MPL lambda expression, thus the MPL substitution should not be performed. </p> Ticket Kohei Takahashi Fri, 06 Jul 2018 16:38:58 GMT <link>https://svn.boost.org/trac10/ticket/5490#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5490#comment:3</guid> <description> <p> <a class="ext-link" href="https://github.com/boostorg/fusion/pull/186"><span class="icon">​</span>https://github.com/boostorg/fusion/pull/186</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Kohei Takahashi</dc:creator> <pubDate>Fri, 06 Jul 2018 23:11:42 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/5490#comment:4 https://svn.boost.org/trac10/ticket/5490#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> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.68.0</span> </li> </ul> Ticket