
On 1/29/2011 3:04 PM, Joachim Faulhaber wrote:
Hi Peter, list, [...] This is a minimal program to demonstrate how 'class value' can confuse msvc: //========================================================= #include<boost/config.hpp> //--- from boost/bind/bind.hpp(112) namespace _bi{ template<class T> class value{}; }
//--- affected code --------------------------------------- template<class Type> struct some_attribute { BOOST_STATIC_CONSTANT(int, value = 0); };
template<class Type> struct some_predicate { BOOST_STATIC_CONSTANT(bool, value = ( some_attribute<Type>::value< 0) //error C2059: syntax error : ')' //IF class template value defined before
Does adding parentheses, i.e., value = ( (some_attribute<Type>::value) < 0 ) help? If so, it could be an alternative to renaming the "value" template...although it could require quite a few more changes to boost code...
); }; //=========================================================
Although I frankly don't know, how exactly msvc is derailed, it seems to have problems with 'value' in
some_attribute<Type>::value< 0
...worth filing a bug in the MS Connect database?
a construction that is extremely frequent due to meta programming conventions introduced by Dave's and Aleksey's boost::mpl. So for a fix I tried to rename 'class value' by something else like 'class _value'. Fortunately this is possible, because the class template is a local implementation object used in boost/bind/bind.hpp only.
Not sure how many value struct templates there are under boost, but I wouldn't be surprised if there were another one for which renaming were *not* an option...
After renaming, I successfully ran all tests from boost/bind. Find the patch file attached. I have also filed a ticket https://svn.boost.org/trac/boost/ticket/5141
- Jeff