fork download
  1. struct Foo
  2. {
  3. int Something () { return 5; }
  4. int Other () { return 0; }
  5. };
  6.  
  7. template<typename T>
  8. void DoSmth (T t)
  9. {
  10. Foo foo;
  11. auto f = foo.Something () > 0 ? [] (Foo f) { return f.Something (); } : [] (Foo f) { return f.Other (); };
  12. }
  13.  
  14. int main ()
  15. {
  16. DoSmth (5);
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void DoSmth(T) [with T = int]':
prog.cpp:16:18:   instantiated from here
prog.cpp:11:113: error: no match for ternary 'operator?:' in '(foo.Foo::Something() > 0) ? DoSmth(T) [with T = int]::<lambda(Foo)>() : DoSmth(T) [with T = int]::<lambda(Foo)>()'
prog.cpp:11:113: error: unable to deduce 'auto' from '<expression error>'
stdout
Standard output is empty