id summary reporter owner description type status milestone component version severity resolution keywords cc 3270 Ambiguous conversion, even though no conversion exists Olaf Lenz Douglas Gregor "Cheers from Germany! Look at the following code: {{{ #include struct A {}; struct B { void f(const A &a) const {} void f(boost::function< void () > a) {} }; int main() { A a; B b; b.f(a); } }}} Compiling this, I get the error: {{{ > g++ boosttest.cpp -o boosttest boosttest.cpp: In function ‘int main()’: boosttest.cpp:13: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: boosttest.cpp:6: note: candidate 1: void B::f(const A&) const boosttest.cpp:7: note: candidate 2: void B::f(boost::function >) }}} When I define B::f() in the first version non-const, the program compiles without any problems. Usually, the problem in these cases is, that the conversion from an A to a const A object is seen as an operation as bad as the conversion of the object to another, therefore it is ambiguous and can be healed by using ""explicit"" in the conversion operator of the other class. Unfortunately, in this case, there does not even exist a conversion from ""class A"" to the function type! To test that, just comment the first definition of B::f(): {{{ f(const A &a) const {} }}} compilation fails with: {{{ > g++ boosttest.cpp -o boosttest [clip] boosttest.cpp:13: instantiated from here /usr/include/boost/function/function_template.hpp:136: error: no match for call to ‘(A) ()’ }}} I think that this can be considered a bug. Or what else can I do in this case?" Bugs closed Boost 1.40.0 function Boost 1.39.0 Problem invalid