Boost C++ Libraries: Ticket #4530: errors with is_convertible on msvc10 https://svn.boost.org/trac10/ticket/4530 <pre class="wiki">#include &lt;boost/spirit/include/qi.hpp&gt; #include &lt;boost/utility/enable_if.hpp&gt; #include &lt;boost/type_traits/is_convertible.hpp&gt; #include &lt;type_traits&gt; template&lt;typename T&gt; struct test { template&lt;typename A&gt; test(A&amp;&amp;, typename boost::enable_if&lt;boost::is_convertible&lt;A&amp;&amp;, T&gt; &gt;::type* =0); }; int main() { typedef boost::spirit::qi::literal_char&lt;boost::spirit::char_encoding::standard,true,false&gt; A; boost::is_convertible&lt;test&lt;A&gt;, A&gt;::value; //std::tr1::is_convertible&lt;test&lt;A&gt;, A&gt;::value; } </pre><p> This snippet fails on msvc10 with the following errors: </p> <pre class="wiki">1&gt;z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(295): error C2039: 'value' : is not a member of 'boost::detail::is_convertible_basic_impl&lt;From,To&gt;' 1&gt; with 1&gt; [ 1&gt; From=test&lt;A&gt; , 1&gt; To=A 1&gt; ] 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(372) : see reference to class template instantiation 'boost::detail::is_convertible_impl&lt;From,To&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; From=test&lt;A&gt; , 1&gt; To=A 1&gt; ] 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(418) : see reference to class template instantiation 'boost::detail::is_convertible_impl_dispatch&lt;From,To&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; From=test&lt;A&gt; , 1&gt; To=A 1&gt; ] 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\utility\enable_if.hpp(36) : see reference to class template instantiation 'boost::is_convertible&lt;From,To&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; From=test&lt;A&gt; &amp;, 1&gt; To=A 1&gt; ] 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(263) : see reference to class template instantiation 'boost::enable_if&lt;Cond,T&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; Cond=boost::is_convertible&lt;test&lt;A&gt; &amp;,A&gt;, 1&gt; T=void 1&gt; ] 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(295) : see reference to class template instantiation 'boost::detail::is_convertible_basic_impl&lt;From,To&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; From=test&lt;A&gt; , 1&gt; To=A 1&gt; ] 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(372) : see reference to class template instantiation 'boost::detail::is_convertible_impl&lt;From,To&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; From=test&lt;A&gt;, 1&gt; To=A 1&gt; ] 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(418) : see reference to class template instantiation 'boost::detail::is_convertible_impl_dispatch&lt;From,To&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; From=test&lt;A&gt;, 1&gt; To=A 1&gt; ] 1&gt; z:\dev\projekte\_test\main.cpp(17) : see reference to class template instantiation 'boost::is_convertible&lt;From,To&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; From=test&lt;A&gt;, 1&gt; To=A 1&gt; ] 1&gt;z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(295): error C2065: 'value' : undeclared identifier 1&gt;z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(295): error C2955: 'boost::type_traits::ice_or' : use of class template requires template argument list 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\detail\ice_or.hpp(21) : see declaration of 'boost::type_traits::ice_or' 1&gt;z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(295): error C2057: expected constant expression 1&gt;z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\is_convertible.hpp(418): error C2975: 'val' : invalid template argument for 'boost::integral_constant', expected compile-time constant expression 1&gt; z:\dev\projekte\boost\boost-dev\boost\boost\type_traits\integral_constant.hpp(18) : see declaration of 'val' </pre><p> Switching to std::tr1::is_convertible makes the code compile fine. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4530 Trac 1.4.3 John Maddock Thu, 12 Aug 2010 11:11:13 GMT status changed https://svn.boost.org/trac10/ticket/4530#comment:1 https://svn.boost.org/trac10/ticket/4530#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Hmmm... I think this is a compiler bug, in trying to work out if test&lt;A&gt; is convertible to A the compiler is for some reason trying to instantiate test&lt;A&gt;::test&lt;A&gt;(test&lt;A&gt;) which causes a cyclic dependency in is_convertible. GCC handles the same code just fine, and switching to std::tr1::is_convertible at the top level breaks the cyclic dependency. </p> <p> I think I can fix this long term by switching over to using the _ _is_convertible compiler intrinsic - but this also means switching is_convertible over to C++0x behaviour from TR1 behaviour which will be a breaking change.... and I'm not sure C++0x behaviour can even be implemented in the language yet for compilers that don't have the intrinsic! </p> <p> Will investigate some more. </p> Ticket John Maddock Thu, 10 Mar 2011 16:52:42 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4530#comment:2 https://svn.boost.org/trac10/ticket/4530#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/69822" title="Change is_convertible to use C++0x behaviour where possible. Change ...">[69822]</a>) Change is_convertible to use C++0x behaviour where possible. Change is_converible to use MSVC <span class="underline">is_convertible intrinsic. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5271" title="#5271: Bugs: is_convertible with 16-byte aligned types causes errors on MSVC (closed: fixed)">#5271</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4530" title="#4530: Bugs: errors with is_convertible on msvc10 (closed: fixed)">#4530</a>. </span></p> Ticket