<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/95544>95544</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Missing symbols with multi-level `auto` deduction
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jpboivin
      </td>
    </tr>
</table>

<pre>
    Hello,

I've simplified a code sample where we have a lambda (with a `const auto&` parameter), that is passed as a templated argument, and then, captured by another lambda (with a `const auto&` parameter), which is then converted to a `std::function`. Replacing either of the `const auto&` with the actual types solve the issue, but with both, while it compiles fine, `std::shared_ptr` symbols needed by the first lambda ends up missing.

It works fine on GCC and MSVC, so I'm not sure if Clang is buggy. If the code does not seem valid from the standard perspective, and the other compilers are just more permissive, feel free to reject).

Here's the code sample:
https://godbolt.org/z/oGETE7o4o
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU8GSozYQ_Rpx6RoXCIztA4eJZ727h70kqVxTDWpAEyFR6gaX8_UpwSQzk8opFxvBU7_u914jsx08UaOOP6njS4aLjCE2r3Mb7Gp91gbzaL6Rc0Hpq8pfVP68_35X-rQSsJ1mZ3tLBhC6YAgYp9kR3EeKBHeCEVcCBIdTaxCUPt-tjICg6rwLngVwkaB0reocZow4kVBU-qL0FWREAcswI3NiYEAQmmaHko5xWCbykpDoDchIPj13OMsSyUD7APRBRor_j_4-2m5M_KkydMGvFBOxhL0Ai1Hlsyqf-8V3YoNXdX6An2l22Fk_ANmNO_SpwH8ybs2kj9jJgg7kMRMDB7fS9toyL5RaaRfZwW2Q8a03R2AFujDN1hFDb_0G_dgYjxjJ_D5LTGz8mNrgGDyR2eVJHL2NLH8LRN4wLDNMltn64fDJcoF7iH_sTBA8fL3uwv_45bdrYuYAKRYT-CDASySwPVwd-iGJ2C7D8DjA912NLSsmEO9goglWdNZAH8O0IVjQG4wGZoo8Uyd2pQ9Ww27s2_iRASPB68ICU4iULm0z7Hd6Igd9JEreRXqlTpS-fJruG0VS-sTv3e1JTkJugFFk5nTSN6VvQzBtcHIIcVD69qfSt_D1y69fTqEKmWlKcykvmFFTnIpzeSqOpzobG2PqWnfm3PeEiKYusE-wc4m5weJSZrbRua7yuqiKUtdFeTB5W13qVpdFdenORqsqpwmtOzi3Tok72xLSXI7HqsoctuR4W2Wtu6S70jptdWwS_qldBlZV7iwLv1cQK27b__3G8QV-7Ob_k5cteNPixD45WsmliG0hrnMwZJYt-9kSXfMvjayMS3vowqT0LfG9_T3NMewW3Lb2WenbPsHa6L8CAAD__6KqgZU">