title: template argument from aliased lambda is invalid
body: <p>(c++20 mode for all of the following)</p>
  <p>I am trying to use std unordered_map with std::reference_wrapper keys to avoid copying somewhat expensive keys, that are stored elsewhere anyway. The referenced type is hashable, but I need to provide forward hasher functors and comparator functors, which I have done as so:</p>
  <pre class="lang-cpp prettyprint-override"><code>template &lt; typename T &gt;
  using default_ref_hasher = decltype([](const std::reference_wrapper&lt; T &gt;&amp; value) {
      return std::hash&lt; std::remove_cvref_t&lt; T &gt; &gt;{}(value.get());
  });
  template &lt; typename T &gt;
  using default_ref_comparator = decltype([](const std::reference_wrapper&lt; T &gt;&amp; ref1,
                                              const std::reference_wrapper&lt; T &gt;&amp; ref2) {
      return ref1.get() == ref2.get();
  });
  </code></pre>
  <p>those are then used in my templated class</p>
  <pre class="lang-cpp prettyprint-override"><code>template &lt;typename Action&gt;
  class Myclass {
  
     std::unordered_map&lt;
        std::reference_wrapper&lt; const Action &gt;,
        double,
        default_ref_hasher&lt; const Action &gt;,
        default_ref_comparator&lt; const Action &gt; &gt;
        map{};
  
  };
  </code></pre>
  <p>I feel as though this is valid c++ code, however, I get the following errors on GCC 11+:</p>
  <pre><code>&lt;source&gt;:24:46: error: template argument 3 is invalid
     24 |       default_ref_comparator&lt; const Action &gt; &gt;
        |                                              ^
  &lt;source&gt;:24:46: error: template argument 4 is invalid
  &lt;source&gt;:20:9: error: '&lt;expression error&gt;' in namespace 'std' does not name a type
     20 |    std::unordered_map&lt;
        |         ^~~~~~~~~~~~~~
     21 |       std::reference_wrapper&lt; const Action &gt;,
        |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     22 |       double,
        |       ~~~~~~~
     23 |       default_ref_hasher&lt; const Action &gt;,
        |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     24 |       default_ref_comparator&lt; const Action &gt; &gt;
        |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ASM generation compiler returned: 1
  </code></pre>
  <p>as can be seen here on <a href="https://godbolt.org/z/rc8a3dE57" rel="nofollow noreferrer">godbolt</a>. If I compile instead with clang 13+ it <a href="https://godbolt.org/z/cxq6dPnEr" rel="nofollow noreferrer">does compile fine</a>.</p>
  <p>Is this a bug in GCC or does clang fail to check a mistake I made?</p>