
AMDG "Richard Crossley" wrote:
Cross posted from the boost users list... Can anyone help me out here?
http://thread.gmane.org/gmane.comp.lib.boost.user/23608/focus=23608
Regards,
Richard.
Ok. I've finally figured out what's happening. It looks like a compiler bug introduced in sp1. Here is the simplest I could reduce it to. struct undefined; template<class T> void f(T) { } template<class T> struct A { }; template<class T> struct B { }; template<class T> struct C { T t; }; int main() { f((A<B<C<undefined> > >*)0); } This causes msvc to instantiate C<undefined>. Note that just B<C<undefined> > is not enough. All three templates are needed. Qualifying the call to f fixes the problem, so this bug appears to be caused by ADL. Now for your problem. The function calls that need to be qualified are visitation_impl_invoke and visitation_impl_invoke_impl in <boost/variant/detail/visitation_impl.hpp>. When I tried that it compiled. Until this is fixed you can use recursive_wrapper directly. struct my_map; typedef boost::variant<int, boost::recursive_wrapper<my_map> > element; struct my_map : std::map<float, element> { my_map(const std::map<float, element>& arg) : std::map<float, element>(arg) {} friend std::ostream& operator<<(std::ostream& os, const my_map& self) { os << static_cast<const std::map<float, element>&>(self); } }; In Christ, Steven Watanabe