Opened 15 years ago

Closed 15 years ago

#1468 closed Bugs (fixed)

[typeof] Problems with VC8/VC9 when using code analysis

Reported by: Richard Webb <richard.webb@…> Owned by: Peder Holt
Milestone: Boost 1.35.0 Component: typeof
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Enabling the Code Analysis option in VC8SP1 and VC9 causes native typeof to fail. For example, the code:

BOOST_AUTO(tmp, std::make_pair(1, 2));

results in the error:

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>        E:\Development\BoostSVN\boost/typeof/msvc/typeof_impl.hpp(174) : see reference to class template instantiation 'boost::type_of::encode_type<T>' being compiled
1>E:\Development\BoostSVN\boost/typeof/msvc/typeof_impl.hpp(172) : error C2440: 'specialization' : cannot convert from 'int' to 'const type_info &'
1>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>        .\Stuff.cpp(19) : see reference to class template instantiation 'boost::type_of::encode_type<T>' being compiled
1>        with
1>        [
1>            T=std::pair<int,int>
1>        ]
1>E:\Development\BoostSVN\boost/typeof/msvc/typeof_impl.hpp(172) : error C2440: 'specialization' : cannot convert from 'int' to 'const type_info &'
1>.\Stuff.cpp(19) : error C2975: 'ref_type_info' : invalid template argument for 'boost::type_of::msvc_typeid_wrapper', expected compile-time constant expression
1>.\Stuff.cpp(19) : error C2440: 'specialization' : cannot convert from 'int' to 'const type_info &'
1>.\Stuff.cpp(19) : error C2440: 'specialization' : cannot convert from 'int' to 'const type_info &'
1>        .\Stuff.cpp(19) : see reference to class template instantiation 'boost::type_of::msvc_typeid_wrapper<ref_type_info>' being compiled
1>        with
1>        [
1>            ref_type_info=0x0
1>        ]
1>.\Stuff.cpp(19) : error C2973: 'boost::type_of::msvc_typeid_wrapper' : invalid template argument 'int'

Everything is ok when analysis is disabled.

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.

Change History (1)

comment:1 by Peder Holt, 15 years ago

Milestone: To Be DeterminedBoost 1.35.0
Resolution: fixed
Status: newclosed

The code for VC8 and VC9 has been reverted to use sizeof in stead of typeid in typeof emulation. This solves the problem.

Note: See TracTickets for help on using tickets.