id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 301,boost::function doesn't accept classes declared in functions,nobody,Douglas Gregor,"{{{ Submitter: John Engström Using MSVC 7.1, I use a functor defined in-scope, as in the following example. ///////////////////// code snippet void bar() { ... struct my_functor { void operator () (int arg1, int arg2) { ... foo(); ... } ... }; my_functor my_functor_instance; boost::function2 my_function1 = boost::ref(my_functor_instance); boost::function2 my_function2 = my_functor_instance; } /////////////////// explanation This fails to compile, see below for error messages, however if I move the declaration of the functor out of the function bar(), it compiles fine. Perhaps it only happens with MSVC. /////////////////// error messages main.cpp(116): error C2893: Failed to specialize function template 'const boost::reference_wrapper boost::ref(T &)' main.cpp(117): error C2440: 'initializing' : cannot convert from 'WinMain::my_functor' to 'boost::function2' with [ R=void, T0=int, T1=int ] }}}",Bugs,closed,,functional,None,,None,,