fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. auto f1 = [](int a){return 0;};
  7. auto f2 = [](int a){if(a == 1) return 0; else return 2;};
  8. auto f3 = [](int a){if(a == 1) return 0; else return 2.3};
  9. auto f4 = [](int a){if(a == 1) return 1.2; else return 2.3};
  10. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In lambda function:
prog.cpp:8:55: error: inconsistent types ‘int’ and ‘double’ deduced for lambda return type
  auto f3 = [](int a){if(a == 1) return 0; else return 2.3};
                                                       ^~~
prog.cpp:8:58: error: expected ‘;’ before ‘}’ token
  auto f3 = [](int a){if(a == 1) return 0; else return 2.3};
                                                          ^
prog.cpp: In lambda function:
prog.cpp:9:60: error: expected ‘;’ before ‘}’ token
  auto f4 = [](int a){if(a == 1) return 1.2; else return 2.3};
                                                            ^
stdout
Standard output is empty