[typeof] fails with Intel Compiler v11.0 on windows

Dear boosters, Could someone out there verify that the following piece of code fails with Intel Compiler v11.0.066 on Windows (Microsoft SDK v6.1): --------------------- #include <boost/typeof/typeof.hpp> #include <vector> using namespace std; int main(int argc, char* argv[]) { vector< int > testvec; BOOST_TYPEOF( testvec.begin() ) i = testvec.begin(); return 0; } --------------------- The compiler output is: --------------------- using typeof emulation C:\boost\include\boost-1_37\boost/typeof/encode_decode.hpp(50): error: incomplete type is not allowed struct encode_type : BOOST_TYPEOF_ENCODE_NS_QUALIFIER::encode_type_impl<V, T> ^ detected during instantiation of class "boost::type_of::encode_type<V, T> [with V=boost::type_of::vector0<void>, T=std::_Vector_iterator<int, std::allocator<int>>]" at line 9 of "typeoftest.cpp" ... --------------------- Preprocessor output shows that encode_type_impl is indeed just forward-declared before encode_type: --------------------- #line 30 "C:\\boost\\include\\boost-1_37\\boost/typeof/encode_decode.hpp" namespace { namespace boost_typeof { template<class V, class Type_Not_Registered_With_Typeof_System> struct encode_type_impl; <snip> }} namespace boost { namespace type_of { template<class V, class T> struct encode_type : boost_typeof::encode_type_impl<V, T> {}; template<class Iter> struct decode_type : boost_typeof::decode_type_impl< typename Iter::type, typename Iter::next > {}; }} --------------------- Is this a bug? Should a header containing the implementation of encode_type_impl be included prior to encode_decode.hpp? Any help appreciated. Cheers, Mikko

AMDG Mikko Vainio wrote:
Could someone out there verify that the following piece of code fails with Intel Compiler v11.0.066 on Windows (Microsoft SDK v6.1):
<snip>
The compiler output is:
--------------------- using typeof emulation <snip>
Is this a bug? Should a header containing the implementation of encode_type_impl be included prior to encode_decode.hpp? Any help appreciated.
This is one of the limitations of emulation mode. There is no portable way for the library to generically register std::vector<T>::iterator. Adding the following lines at global scope makes the code compile #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() BOOST_TYPEOF_REGISTER_TYPE(vector<int>::iterator) In Christ, Steven Watanabe
participants (2)
-
Mikko Vainio
-
Steven Watanabe