Hello,

I got hands on the Visual Studio 2010 Beta 1 and had to rebuild the 1.34.1 version of boost libraries I use in my project with the new VC 10 compiler. Thread, Test, IOStreams, Filesystem built fine, but program_options failed.

Let me first clarify why I do need 1.34.1: This is the version that is most available on Linux servers (including the one I develop for), so I need this version on my development box to ensure source code compatibility, even though this version does not officially support even VC 9 (which however builds it fine and I happily use it).

Below I list the errors that happened with the VC 10 compiler. I aggregated them to 3 issues. For multiple occurences of issue 1., I only copy/paste the full output for the first occurence.

I would welcome if someone could tell me if these are the new compiler's fault, or not. If they are, I plan to report them on MS Connect so that they can hopefully get fixed before next Beta (or at least before the RTM).

1. C2668: 'boost::bind' : ambiguous call to overloaded function
========================================
Happens here:

libs\program_options\src\cmdline.cpp(198)
libs\program_options\src\cmdline.cpp(202)
libs\program_options\src\cmdline.cpp(206)
libs\program_options\src\cmdline.cpp(210)
libs\program_options\src\cmdline.cpp(213)
libs\program_options\src\cmdline.cpp(215)

libs\program_options\src\parsers.cpp(73)

For the first occurence (cmdline.cpp(198)), the message states these further details (I checked the boost::bind vs. std::tr1::bind is listed in all 7 occurences):

        C:\Documents and Settings\Boris\My Documents\Downloads\boost_1_34_1\boost/bind/bind_mf_cc.hpp(43): could be 'boost::_bi::bind_t<R,F,L> boost::bind<std::vector<_Ty>,boost::program_options::detail::cmdline,std::vector<std::string>&,boost::program_options::detail::cmdline*,boost::arg<I>>(R (__thiscall boost::program_options::detail::cmdline::* )(B1),A1,A2)'
        with
        [
            R=std::vector<boost::program_options::option>,
            F=boost::_mfi::mf1<std::vector<boost::program_options::option>,boost::program_options::detail::cmdline,std::vector<std::string> &>,
            L=boost::_bi::list2<boost::_bi::value<boost::program_options::detail::cmdline *>,boost::arg<1>>,
            _Ty=boost::program_options::option,
            I=1,
            B1=std::vector<std::string> &,
            A1=boost::program_options::detail::cmdline *,
            A2=boost::arg<1>
        ]
        C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xxbind1(431): or       'std::tr1::_Bind<_Result_type,_Ret,_BindN> std::tr1::bind<boost::program_options::detail::cmdline,std::vector<_Ty>&,boost::program_options::detail::cmdline*,boost::arg<I>,std::vector<boost::program_options::option>>(_Rx (__thiscall boost::program_options::detail::cmdline::* const )(_Farg1),_Arg0,_Arg1)' [found using argument-dependent lookup]
        with
        [
            _Result_type=std::vector<boost::program_options::option>,
            _Ret=std::vector<boost::program_options::option>,
            _BindN=std::tr1::_Bind2<std::tr1::_Callable_pmf<std::vector<boost::program_options::option> (__thiscall boost::program_options::detail::cmdline::* const )(std::vector<std::string> &),boost::program_options::detail::cmdline,false>,boost::program_options::detail::cmdline *,boost::arg<1>>,
            _Ty=std::string,
            I=1,
            _Rx=std::vector<boost::program_options::option>,
            _Farg1=std::vector<std::string> &,
            _Arg0=boost::program_options::detail::cmdline *,
            _Arg1=boost::arg<1>
        ]
        while trying to match the argument list '(std::vector<_Ty> (__thiscall boost::program_options::detail::cmdline::* )(std::vector<std::string> &), boost::program_options::detail::cmdline *const , boost::arg<I>)'
        with
        [
            _Ty=boost::program_options::option
        ]
        and
        [
            I=1
        ]

2. Deduction of template parameters for std::transform (C2780, C2784)
=================================================
libs\program_options\src\parsers.cpp(73) : error C2780: '_OutTy *std::transform(_InIt1,_InIt1,_InTy (&)[_InSize],_OutTy (&)[_OutSize],_Fn2)' : expects 5 arguments - 4 provided
        C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\algorithm(1288) : see declaration of 'std::transform'
libs\program_options\src\parsers.cpp(73) : error C2780: '_OutTy *std::transform(_InIt1,_InIt1,_InIt2,_OutTy (&)[_OutSize],_Fn2)' : expects 5 arguments - 4 provided
        C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\algorithm(1274) : see declaration of 'std::transform'
libs\program_options\src\parsers.cpp(73) : error C2780: '_OutIt std::transform(_InIt1,_InIt1,_InTy (&)[_InSize],_OutIt,_Fn2)' : expects 5 arguments - 4 provided
        C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\algorithm(1262) : see declaration of 'std::transform'
libs\program_options\src\parsers.cpp(73) : error C2780: '_OutIt std::transform(_InIt1,_InIt1,_InIt2,_OutIt,_Fn2)' : expects 5 arguments - 4 provided
        C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\algorithm(1244) : see declaration of 'std::transform'
libs\program_options\src\parsers.cpp(73) : error C2784: '_OutTy *std::transform(_InIt,_InIt,_OutTy (&)[_OutSize],_Fn1)' : could not deduce template argument for '_OutTy (&)[_OutSize]' from 'std::back_insert_iterator<_Container>'
        with
        [
            _Container=std::vector<std::wstring>
        ]
        C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\algorithm(1122) : see declaration of 'std::transform'

3. cannot convert from 'std::_Tree_const_iterator<_Mytree>' to 'std::_Tree_iterator<_Mytree>
=================================================================
C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\map(258) : error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<_Mytree>' to 'std::_Tree_iterator<_Mytree>'
        with
        [
            _Mytree=std::_Tree_val<std::_Tmap_traits<std::string,boost::program_options::variable_value,std::less<std::string>,std::allocator<std::pair<const std::string,boost::program_options::variable_value>>,false>>
        ]
        No constructor could take the source type, or constructor overload resolution was ambiguous
        C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\map(257) : while compiling class template member function 'const boost::program_options::variable_value &std::map<_Kty,_Ty>::at(const std::basic_string<_Elem,_Traits,_Ax> &) const'
        with
        [
            _Kty=std::string,
            _Ty=boost::program_options::variable_value,
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        C:\Documents and Settings\Boris\My Documents\Downloads\boost_1_34_1\boost/program_options/variables_map.hpp(139) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
        with
        [
            _Kty=std::string,
            _Ty=boost::program_options::variable_value
        ]



Maybe this info from VC10 developer blog helps for some cases: "TR1/C++0x components ... they still live in std::tr1 and are dragged into std with using-declarations" [1]

Any comments on whether these are compiler's faults or not would be welcome.

Thanks,
Boris Dušek

[1]: http://blogs.msdn.com/vcblog/archive/2009/05/25/stl-breaking-changes-in-visual-studio-2010-beta-1.aspx