
Arkadiy Vertleyb wrote:
"Tobias Schwinger" <tschwinger@neoscientists.org> wrote
Most unfortunately the function pointer is not the problem, here. Same problem, except that T should now be:
action<anychar_parser, functor>
...and MSVC still won't tell us ;-).
Can you take the expression whose typeof you are trying to take, and just pass it into:
template<class T> void foo(const T&) {}
I can. I can also use a function template like template<typename T> int eat(T const &) { return 0; } and #define an_expression eat(anychar_p[ a_placeholder ]) // note: eat(T const &) in place of of the operator+(parser<D> const &) and it works within Typeof. Even better (and now things really get weird): #define an_expression anychar_p[ a_placeholder ] >> anychar_p // note: don't forget to register boost::spirit::sequence<class,class> // when trying this one works. Looking at definition of operator>> in boost/spirit/core/composite/sequence.hpp we see the same deduction. The only differences: it's a binary operator and heavily overloaded (for one parser argument and the other argument being char, wchar_t, char const *, wchar_t const *). So I added a function like this template<typename U, typename V> int whattheheck(boost::spirit::parser<U> const &, boost::spirit::parser<V> const &) { return 0; } #define an_expression whattheheck(anychar_p[ a_placeholder ],anychar_p) and get an error. Now when I add an overload like this: struct surprise { }; template<typename U> int whattheheck(surprise, boost::spirit::parser<U> const &) { return 0; } things work again.
If it still fails, binding is the problem. We will not solve the problem this way, but we'll at least classify it...
Well, I just found a workaround while just replying (the "cardboard programmer" [ http://tinyurl.com/9xcf7 ] effect, I guess). The workaround isn't too pretty (especially because I still don't really understand it) but still: namespace boost { namespace spirit { struct msvc_workaround { }; int operator+(msvc_workaround) { return 0; } } } Thanks, Tobias