fork download
  1. #include <iostream>
  2.  
  3. template <typename FuncType>
  4. std::pair<int,int> DoSomething() {
  5. return FuncType()(std::make_pair(1,1));
  6. }
  7.  
  8. int main() {
  9. auto myLambda = [](std::pair<int,int> x) {
  10. return std::make_pair(x.first*2,x.second*2);
  11. };
  12. std::pair<int,int> res = DoSomething<decltype(myLambda)>();
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘std::pair<int, int> DoSomething() [with FuncType = main()::<lambda(std::pair<int, int>)>]’:
prog.cpp:12:59:   required from here
prog.cpp:5:9: error: use of deleted function ‘main()::<lambda(std::pair<int, int>)>::<lambda>()’
  return FuncType()(std::make_pair(1,1));
         ^~~~~~~~~~
prog.cpp:9:19: note: a lambda closure type has a deleted default constructor
  auto myLambda = [](std::pair<int,int> x) {
                   ^
stdout
Standard output is empty