title: non returning lambda with captures as function pointer
body: <p>My code (C++) need to pass lambda as function pointer. My lambdas always: a) return void; b) never takes any parameter; and c) can have zero or more capture arguments. I want to pass this lambda as a function pointer but unable to do so. Any advice ?</p>
  
  <p>Sample code:</p>
  
  <pre><code>void fptrfunc(void (*fptr)()){ 
    fptr();
  }
  
  int main(){
    int x = 2;
    fptrfunc([](){cout &lt;&lt; "LAMBDA CALL--1"&lt;&lt; endl; });            // Works
    fptrfunc([x](){cout &lt;&lt; "LAMBDA CALL--2"&lt;&lt; endl; });           // Does not compile
    return 0;
  } 
  </code></pre>