title: std::function vs callable as template parameter
body: <p>In the example below, why line 20 causes the error described from line 27 to 30?</p>
  <p>Calling <code>exec1</code> in line 33 works fine.</p>
  <pre><code>#include &lt;cstdint&gt;
  #include &lt;functional&gt;
  #include &lt;iostream&gt;
  #include &lt;tuple&gt;
  #include &lt;type_traits&gt;
  
  template &lt;typename... t_fields&gt;
  void exec0(std::function&lt;std::tuple&lt;t_fields...&gt;()&gt; generate,
             std::function&lt;void(t_fields &amp;&amp;...)&gt; handle) {
    std::tuple&lt;t_fields...&gt; _tuple{generate()};
    std::apply(handle, std::move(_tuple));
  }
  
  template &lt;typename t_generate, typename t_function&gt;
  void exec1(t_generate generate, t_function handle) {
    auto _tuple{generate()};
    std::apply(handle, std::move(_tuple));
  }
  
  int main() {
    auto _h = [](uint32_t u) -&gt; void { std::cout &lt;&lt; &quot;u = &quot; &lt;&lt; u &lt;&lt; '\n'; };
  
    auto _g = []() -&gt; std::tuple&lt;uint32_t&gt; { return std::tuple&lt;uint32_t&gt;{456}; };
  
    //  exec0&lt;uint32_t&gt;(_g, _h);
    /*
  main.cpp:25:3: error: no matching function for call to 'exec0'
  main.cpp:8:6: note: candidate template ignored: could not match
  'function&lt;tuple&lt;unsigned int, type-parameter-0-0...&gt; ()&gt;' against '(lambda at
  /var/tmp/untitled002/main.cpp:23:13)'
    */
  
    exec1(_g, _h);
  
    return 0;
  }
  </code></pre>
  <p><code>g++ --version</code> replies:</p>
  <pre><code>g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
  Copyright (C) 2019 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  </code></pre>