« Return to Thread: [bind] MSVC 7.1 problem

Re: [bind] MSVC 7.1 problem

by Peter Dimov-5 :: Rate this Message:

Reply to Author | View in Thread

Johan Torp:

> The following code compiles fine in MSVC 8.0 and gcc 3.4.4 but MSVC 7.1
> renders the errors found below.
>
>  struct X {
>    template<class T> void bar() {}
>  };
>
>  void foo() {
>     X x;
>     boost::bind(&X::bar<int>,  x);
>  }
>
> I'm using boost 1.34.0. Is this a known problem of MSVC 7x?

Function templates have been known to confuse earlier versions of MSVC. I
don't think that this specific problem has been known, but now it is. :-)
The usual workaround is to help the compiler by using

    void (X::*pmf) () = &X::bar<int>;

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

 « Return to Thread: [bind] MSVC 7.1 problem