fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. auto l = []{ return 5; };
  6.  
  7. decltype(l) new_lambda = [](){ return 7; } ;
  8.  
  9. std::cout << new_lambda() << std::endl;
  10.  
  11. return 0;
  12. }
  13.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:7:43: error: conversion from ‘main()::<lambda()>’ to non-scalar type ‘main()::<lambda()>’ requested
  decltype(l) new_lambda = [](){ return 7; } ;
                                           ^
stdout
Standard output is empty