Boost C++ Libraries: Ticket #1468: [typeof] Problems with VC8/VC9 when using code analysis https://svn.boost.org/trac10/ticket/1468 <p> Enabling the Code Analysis option in VC8SP1 and VC9 causes native typeof to fail. For example, the code: </p> <pre class="wiki">BOOST_AUTO(tmp, std::make_pair(1, 2)); </pre><p> results in the error: </p> <pre class="wiki">E:\Development\BoostSVN\boost/typeof/msvc/typeof_impl.hpp(172) : error C2975: 'ref_type_info' : invalid template argument for 'boost::type_of::msvc_typeid_wrapper', expected compile-time constant expression 1&gt; E:\Development\BoostSVN\boost/typeof/msvc/typeof_impl.hpp(174) : see reference to class template instantiation 'boost::type_of::encode_type&lt;T&gt;' being compiled 1&gt;E:\Development\BoostSVN\boost/typeof/msvc/typeof_impl.hpp(172) : error C2440: 'specialization' : cannot convert from 'int' to 'const type_info &amp;' 1&gt;E:\Development\BoostSVN\boost/typeof/msvc/typeof_impl.hpp(172) : error C2975: 'ref_type_info' : invalid template argument for 'boost::type_of::msvc_typeid_wrapper', expected compile-time constant expression 1&gt; .\Stuff.cpp(19) : see reference to class template instantiation 'boost::type_of::encode_type&lt;T&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; T=std::pair&lt;int,int&gt; 1&gt; ] 1&gt;E:\Development\BoostSVN\boost/typeof/msvc/typeof_impl.hpp(172) : error C2440: 'specialization' : cannot convert from 'int' to 'const type_info &amp;' 1&gt;.\Stuff.cpp(19) : error C2975: 'ref_type_info' : invalid template argument for 'boost::type_of::msvc_typeid_wrapper', expected compile-time constant expression 1&gt;.\Stuff.cpp(19) : error C2440: 'specialization' : cannot convert from 'int' to 'const type_info &amp;' 1&gt;.\Stuff.cpp(19) : error C2440: 'specialization' : cannot convert from 'int' to 'const type_info &amp;' 1&gt; .\Stuff.cpp(19) : see reference to class template instantiation 'boost::type_of::msvc_typeid_wrapper&lt;ref_type_info&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; ref_type_info=0x0 1&gt; ] 1&gt;.\Stuff.cpp(19) : error C2973: 'boost::type_of::msvc_typeid_wrapper' : invalid template argument 'int' </pre><p> Everything is ok when analysis is disabled. </p> <p> I've previously been using a Boost1.34.1 patched with the first version of typeof with VC8 native support, and that works ok in either case. Looking through the change history, it seems to have started failing at revision 38801. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1468 Trac 1.4.3 Peder Holt Thu, 06 Dec 2007 10:12:14 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/1468#comment:1 https://svn.boost.org/trac10/ticket/1468#comment:1 <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.35.0</span> </li> </ul> <p> The code for VC8 and VC9 has been reverted to use sizeof in stead of typeid in typeof emulation. This solves the problem. </p> Ticket