title: What is the lifetime of the target of pointer-to-function pointing to a lambda?
body: <p>Sorry, it's a long-winded question, but let me break it down:</p>
  
  <p>Does the C++ standard guarantee that:</p>
  
  <pre><code>void (*Ptr)(void) = [] {};
  return Ptr;
  </code></pre>
  
  <p>will still be defined behaviour?</p>
  
  <p>I understand that, for a closure, it will be defined, because that closure object is moved/copied by value; but, while I know a 'regular' function has infinite/no lifetime, does the target of Ptr have the same? Or is it destroyed and recreated with each instantiation of the lambda?</p>
  
  <p>The reason I care is, I can't use lambdas as callbacks if not. I want to know.</p>