Construction/assignment inconsistency with boost::function on MSVC2005
Hello, I encountered the following inconsistency constructing a boost::function object from a pointer to a template function. template <typename T> void foo(T) {} int main(int argc, char **argv) { boost::function<void (int)> f1; f1 = foo<int>; boost::function<void (int)> f2 = foo<int>; f1(0); // ok f2(0); // error, function pointer is zero! return 0; } I am compiling on MSVC2005 SP1, using boost version 1.34.1. It seems to work properly with GCC 4.1.2 and boost 1.33.1 on Ubuntu, however. Is this a known problem? Best Regards, Josef Grahn
on Thu Aug 23 2007, Josef Grahn <josef.grahn-AT-optonova.se> wrote:
I am compiling on MSVC2005 SP1, using boost version 1.34.1. It seems to work properly with GCC 4.1.2 and boost 1.33.1 on Ubuntu, however.
Is this a known problem?
According to someone at Microsoft: "this is a known issue with Visual C+ 2005 (including Visual C++ 2005 SP1) – it has been fixed in Visual C++ 2008." -- Dave Abrahams Boost Consulting http://www.boost-consulting.com The Astoria Seminar ==> http://www.astoriaseminar.com
Josef Grahn <josef.grahn <at> optonova.se> writes:
Hello,
I encountered the following inconsistency constructing a boost::function object from a pointer to a template function.
template <typename T> void foo(T) {}
int main(int argc, char **argv) { boost::function<void (int)> f1; f1 = foo<int>; boost::function<void (int)> f2 = foo<int>;
f1(0); // ok f2(0); // error, function pointer is zero!
return 0; }
I am compiling on MSVC2005 SP1, using boost version 1.34.1.
Maybe it is the same problem as depicted in thread 'Boost.Function and template function', although I did use VStudio 2003. I also post it on a m$ newsgroup, but got no reaction from M$. Mr. Abrahams has obviously better contacts there (see his reaction)...
participants (3)
-
David Abrahams
-
gast128
-
Josef Grahn