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

    <tr>
        <th>Summary</th>
        <td>
            [clang] return type deduction fails for function recursively invoked via intermediate constexpr function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Following code fails to compile, unless 'constexpr' qualifier is removed from visitType:

`struct visitor {
 template < typename T >
    static auto visit() {
        return visitType< T >();
    }

    template < typename T >
    static constexpr void visitType() {
        visit< typename T::next_type>();
 }
};

struct iface  {
    using next_type = iface;
};

void foo()
{
 visitor::visit<iface>();
}
`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk01z4ywMxz8NvmiawRDHzcGHtnnyCXp_BmORsIvBC8Jtvv2OX_LS7exhfcCMkP78JCSVkj15xIZVr6w6FCrTOcSm1-h1iKpoQ3dpjsG58GH9CXToEIyyLgEF0KEfrEMm3iB7hykBE7UOPhF-DpGJGn5l5ayxGMEmiNiHETswMfQw2mTp_TIgky-MHxi_rjueKGZNi0eIwOrX5QgI-8EpQmDyDegyoFc9wjsw-d_qAQCJFFkNKlNYJJh4ZmL_ILN-ESlH_wjytmrNAUw--LP68Ag5mf4F5lYTGIPtHq78C9rC_UV3KpN88fhJ_9MM-w3zzlgfbtZlXStqjdIIX6_LaXrXmy4weVj87hLf5OYkTAgrwep1FV3fbQG-ZrJK_gl9Z97xZVN0jez2cq8KbMpdXVdbUUtenBtVyhb3z7uOV3VbdVvZctNKU9a85LrkVWEbwYXkQjxzzivJN9u2rUxtsDQ1ylYrtuXYK-s2zo39JsRTYVPK2OxKvi0Lp1p0aZ4DITx-wHzIhJjGIjZTzFObT4ltubOJ0l2FLLl5gLRT_sSqw7W15oJ22GVNNvh1bkyIYLJfTBF1jsmO6C5g_Rh-4tQdCqwnjD12dmqwe_dc44ocXXMmGtJUZXFk4niydM7tRoeeieOEtv6ehhh-oCYmjnNCiYnjnPDvAAAA__-gfjUw">