Boost C++ Libraries: Ticket #12052: Boost 1.60 any.hpp error: 'if_' in namespace 'boost::mpl' does not name a template type https://svn.boost.org/trac10/ticket/12052 <p> Linux 3.19.0-51-generic <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/58" title="#58: Tasks: Virtual Target Cache (closed: Fixed)">#58</a>-Ubuntu SMP Fri Feb 26 21:22:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Ubuntu 15.04 </p> <p> Boost 1.60 </p> <p> #include &lt;iostream&gt; #include &lt;boost/any.hpp&gt; </p> <p> int main() { </p> <blockquote> <p> boost::any a = 1; std::cout &lt;&lt; boost::any_cast&lt;int&gt;(a) &lt;&lt; '\n'; a = 3.14; std::cout &lt;&lt; boost::any_cast&lt;double&gt;(a) &lt;&lt; '\n'; a = true; std::cout &lt;&lt; std::boolalpha &lt;&lt; boost::any_cast&lt;bool&gt;(a) &lt;&lt; '\n'; </p> </blockquote> <p> } </p> <p> This code generates a compilation error: </p> <p> /usr/include/boost/any.hpp: In function ‘<a class="missing wiki">ValueType</a> boost::any_cast(boost::any&amp;)’: /usr/include/boost/any.hpp:292:52: error: ‘if_’ in namespace ‘boost::mpl’ does not name a template type </p> <blockquote> <p> typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_&lt; </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> /usr/include/boost/any.hpp:292:55: error: expected unqualified-id before ‘&lt;’ token </p> <blockquote> <p> typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_&lt; </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> /usr/include/boost/any.hpp:298:28: error: ‘ref_type’ does not name a type </p> <blockquote> <p> return static_cast&lt;ref_type&gt;(*result); </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12052 Trac 1.4.3 Antony Polukhin Mon, 02 Jan 2017 10:11:20 GMT owner, status changed https://svn.boost.org/trac10/ticket/12052#comment:1 https://svn.boost.org/trac10/ticket/12052#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">nasonov</span> to <span class="trac-author">Antony Polukhin</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Looks like this was fixed in <a class="ext-link" href="https://github.com/boostorg/any/commit/ed7cac4ee207b125aa25144f2674f9550def2232"><span class="icon">​</span>ed7cac4e</a>. Are you sure that Boost. 1.60 is used on your system? Does the fix line exist in your header? </p> Ticket Antony Polukhin Mon, 02 Jan 2017 10:14:59 GMT status changed https://svn.boost.org/trac10/ticket/12052#comment:2 https://svn.boost.org/trac10/ticket/12052#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> </ul> Ticket Christopher Arndt Sun, 22 Jan 2017 15:28:11 GMT <link>https://svn.boost.org/trac10/ticket/12052#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12052#comment:3</guid> <description> <p> A similar bug exists in <code>classic_utility.hpp</code> (resp. <code>boost/spirit/home/classic/utility.hpp), which also fails to include </code>if.hpp`. </p> <pre class="wiki">Checking for header boost/spirit/include/classic_utility.hpp ==&gt; #include &lt;boost/spirit/include/classic_utility.hpp&gt; int main(int argc, char **argv) { (void)argc; (void)argv; return 0; } &lt;== [1/2] Compiling ESC[32mbuild/.conf_check_f294e83272b96d2356ef0156052d5b3c/test.cppESC[0m ['/usr/lib/ccache/bin/g++', '-std=c++11', '-march=x86-64', '-mtune=generic', '-O2', '-pipe', '-fstack-protector', '-D_FORTIFY_SOURCE=2', '-DVERSION="1.0.0"', '-DHAVE_BOOST_SPIRIT_INCLUDE_CLASSIC_DYNAMIC_HPP=1', '-DHAVE_BOOST_SPIRIT_INCLUDE_CLASSIC_CORE_HPP=1', '-DHAVE_BOOST_SPIRIT_INCLUDE_CLASSIC_PARSE_TREE_HPP=1', '../test.cpp', '-c', '-o', '/home/chris/src/arch/aur/ttl2c-git/src/ttl2c/build/.conf_check_f294e83272b96d2356ef0156052d5b3c/testbuild/test.cpp.1.o'] err: In file included from /usr/include/boost/spirit/home/classic/utility.hpp:30:0, from /usr/include/boost/spirit/include/classic_utility.hpp:11, from ../test.cpp:1: /usr/include/boost/spirit/home/classic/utility/loops.hpp:269:35: error: 'if_' in namespace 'boost::mpl' does not name a template type typedef typename mpl::if_&lt; ^~~ /usr/include/boost/spirit/home/classic/utility/loops.hpp:269:38: error: expected unqualified-id before '&lt;' token typedef typename mpl::if_&lt; ^ </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Tue, 31 Jan 2017 19:53:26 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12052#comment:4 https://svn.boost.org/trac10/ticket/12052#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">worksforme</span> </li> </ul> <p> Added a test in <a class="ext-link" href="https://github.com/boostorg/any/commit/c8a2c96a44aba1026d11e84e8325260f22b2199e"><span class="icon">​</span>c8a2c96a</a>. The issue is <a href="http://www.boost.org/development/tests/develop/developer/any.html">not reproducable</a>. </p> Ticket