<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64029>64029</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang 16 -> 17 regression: "deduced return type cannot be used before it is defined"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
helmesjo
</td>
</tr>
</table>
<pre>
See minimal reproducer [here (godbolt)](https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGIMwDMpK4AMngMmAByPgBGmMQgQQAOqAqETgwe3r7%2ByanpAmER0SxxCUF2mA4ZQgRMxARZPn6Btpj2jgK19QRFUbHxibZ1DU05rQojveH9pYMBAJS2qF7EyOwc5gHhyN5YANQmAW4AbvFpAkfYJhoAgls7e5iHx2gM60kEClc394GPXgORzcBAAnklMAB9AjEJiEb4Ba53B7vJ4vNxeRy0Qign7I5H/Kj7MBgLA0CLoCCQyHIJJJSHYmKQ/jEADu9XQDLwAGtMAtfsw2Aokkx1vtJuhfiYAOxWO77fYAekV%2BzcxEw%2BAIIH2CAIBCSChAysYADpaUl1VR4ox1mbUCxFazFebFZi6DjFSz2cROdjeb8FQRMCwkgYg8DdkwFAp9gAVUj7SPR/ZyPG3BUmACsVmzDAweAUoh9WYAIqXEwJJphVBb9kxMahzAA2Zv7L0crm8iCpswt3v7VQLfZ56sfAgBw6yicKt5VmvEfYxVCefYFyFMdD4Iw0ysEF4l/YgEASo9r2cESEnYFHk8gdUsVBnSGW63vKHj46xn6Io5y9MK1ciXPatawgG8CHQU8FAZE4xC8KEX3VN9L2BL9e2bK5%2BXlACZT/ACALwIDdxAhcIDXDct2AHcGEmLD/3whV1QIVYGEPY8IKPKN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2BEVKESgOBVEYReAYNyK2mAeb80FiLMWzs%2BB0GlrLeWlsNYq2zkMrWOs9YOGzkbRgBBTbmwVtbW29tHbZ1dlXD2P0va319grAOyAg7Z1DpQn6EcVbRw2D9OOCdnZJwMKndOnSs7dK0XnDR0gtGKB0WXfwlcjAoBrjYRk49m6t0rJwTuEFu69ysJYAeuMzjEBHmPeAP8b5nz8BAVwl9F6z0/qvXe%2BRN7YoJRvDIeLj6T1vufHoxLKXou6A0clT936jFfnoSYH9l6PwAcsVY/8sGmPMbE36nBwHOKkXUsyDSmlDggKgogC5wbYMKTDUgqSEaZMyaYqJIA6HCrxsw1hJNinwDKSAbhtiSoUH4dTZmIi2BiIkS46RUriCNO5MqjUaCkUqNkK8gu7zZCfNLnon5himDGJuYKvJcSODWJ4XuBxYrJGuMahAaVHqzI%2BMEfEfxZhlVsPwaErA4TAFUN4NEixID4mExVSk%2BG6TNUo1Mbkqt%2BSgnJLLWYGNIqCmFqWAii4fhJBAA).
It works fine in Clang 16.0.0 (and older, tested back to 11.0), but fails in 17 (trunk).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcVsmygkrTfBrOxrgnoAWExVl0M48yCIo7JptmVAZBn_4PvTfij_g2TdNFFZkJVZHpNBHcl-UfxSGKk3_SZa6G8a8q266c6uEnG4rXX1iWu470pEvb3Vjex6FY8nLcURyqyrHcUUDAQ5EN7UwBkeJkCgjVPN8nag8poFJA_S_6O4z4e7B_U3t4TGxcQRU9Cs6XNpisXoIcqUNBgWyoMr6Uw9RTJOi8VzQ78AD9VZ0dH71ggEVr9hMFviaS0f4FSpuAELQG1J8gjKB-X6HzhGpyCmcTM7IB71BKoL8kS9OKV3haZasuoKZGM7TYSTOcVXbuFgudHjsdRC8PI61zfOz78PiAD-WE13I_HijAAfRK-zvslIAOt02KVNBB9urjwNlgcPV6Hs33GtTYYkQ_UKNM30h2ZeSI5kZ_qJ-lLt4TB0EzBA_1oLyOa85hvXq5XAJdv4NnFmZP9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