fork(2) download
  1. #include <iostream>
  2. #include <functional>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. std::string g;
  8. bool b = false;
  9. function<void()> f = b ? [g](){} : string("AAA");
  10. return 0;
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:9:25: error: operands to ?: have different types 'main()::<lambda()>' and 'std::string {aka std::basic_string<char>}'
  function<void()> f = b ? [g](){} : string("AAA");
                         ^
stdout
Standard output is empty