title: mingw: Invalid conversion from lambda to function pointer
body: <p>Trying to supply a lambda as a function pointer to a Win32 API call fails when compiling using mingw 5.3.0, although it compiles fine when using MSVC (of Visual Studio 2013).</p>
  
  <p>MCVE:</p>
  
  <pre><code>#include &lt;Windows.h&gt;
  
  int main(int argc, char *argv[])
  {
      bool parameterData;
  
      EnumWindows([](HWND windowHandle, LPARAM parameter) -&gt; BOOL {
          return 1;
      }, reinterpret_cast&lt;LPARAM&gt;(&amp;parameterData));
  }
  </code></pre>
  
  <p>GCC throws the following error message, which I can't wrap my head around:</p>
  
  <pre><code>error: invalid user-defined conversion from 'main(int, char**)::&lt;lambda(HWND, LPARAM)&gt;' to 'WNDENUMPROC {aka int (__attribute__((__stdcall__)) *)(HWND__*, long int)}' [-fpermissive]
    }, reinterpret_cast&lt;LPARAM&gt;(&amp;parameterData));
                                               ^
  note: candidate is: main(int, char**)::&lt;lambda(HWND, LPARAM)&gt;::operator BOOL (*)(HWND, LPARAM)() const &lt;near match&gt;
    EnumWindows([](HWND windowHandle, LPARAM parameter) -&gt; BOOL {
                                                           ^
  note:   no known conversion from 'BOOL (*)(HWND, LPARAM) {aka int (*)(HWND__*, long int)}' to 'WNDENUMPROC {aka int (__attribute__((__stdcall__)) *)(HWND__*, long int)}'
  In file included from C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/Windows.h:72:0,
                   from main.cpp:1:
  note:   initializing argument 1 of 'WINBOOL EnumWindows(WNDENUMPROC, LPARAM)'
     WINUSERAPI WINBOOL WINAPI EnumWindows(WNDENUMPROC lpEnumFunc,LPARAM lParam);
  </code></pre>
  
  <p>What is it exactly that GCC does not like? What needs to be changed in order to use the lambda as first parameter to <code>EnumWindows</code>?</p>