fork download
  1. #include <functional>
  2.  
  3. void test(std::function<void(int)> f) {}
  4. void test(std::function<int(int)> f) {}
  5.  
  6. int main()
  7. {
  8. test([] (int x) -> int { return x; });
  9. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:2: error: call to 'test' is ambiguous
        test([] (int x) -> int { return x; });
        ^~~~
prog.cpp:3:6: note: candidate function
void test(std::function<void(int)> f) {}
     ^
prog.cpp:4:6: note: candidate function
void test(std::function<int(int)> f) {}
     ^
1 error generated.
stdout
Standard output is empty