c++11-lambda-type.cc #include <functional> void foo(std::function<void()>) {} void foo(std::function<bool()>) {} int main() { foo([]() -> bool { return true; }); } g++ -std=c++11 c++11-lambda-type.cc c++11-lambda-type.cc: In function ‘int main()’: c++11-lambda-type.cc:7:36: error: call of overloaded ‘foo(main()::__lambda0)’ is ambiguous foo([]() -> bool { return true; }); ^ c++11-lambda-type.cc:7:36: note: candidates are: c++11-lambda-type.cc:3:6: note: void foo(std::function<void()>) void foo(std::function<void()>) {} ^ c++11-lambda-type.cc:4:6: note: void foo(std::function<bool()>) void foo(std::function<bool()>) {} ^ clang++ -std=c++11 c++11-lambda-type.cc c++11-lambda-type.cc:7:3: error: call to 'foo' is ambiguous foo([]() -> bool { return true; }); ^~~ c++11-lambda-type.cc:3:6: note: candidate function void foo(std::function<void()>) {} ^ c++11-lambda-type.cc:4:6: note: candidate function void foo(std::function<bool()>) {} ^ 1 error generated.