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

    <tr>
        <th>Summary</th>
        <td>
            Failed to match declaration to definition of requires-constrained function since clang-17
        </td>
    </tr>

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

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

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

<pre>
    Since clang-17, I cannot split a declaration of a function constrained by requires concept from its definition, due to clang failing to match them. This works perfectly fine in previous versions of clang and the code runs as intended.

<source>:40:59: error: out-of-line definition of 'index' does not match any declaration in 'DerivedCollection<DerTs...>'
   40 | inline constexpr std::size_t DerivedCollection<DerTs...>::index()

**Minimal reproducible example on https://godbolt.org/z/3bjhv46ja**

Furthermore, when running it with assertions enabled, clang fails to build it with return err code 254 due to.

clang-17: /root/llvm-project/clang/include/clang/AST/TemplateBase.h:399: unsigned int clang::TemplateArgument::pack_size() const: Assertion `getKind() == Pack' failed.

**Minimal reproducible example with assertions on https://godbolt.org/z/xEYnrKh5z**

By commenting out the requires (lines with comment  // COMMENT ME OUT AND I WILL COMPILE), the code seems to build and run correctly. Some incorrect matching of signatures seems to be going on when constrained.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVU1v4zgM_TXKhajhSLETH3xwk3pRTDtToFks9jSQLTpWK0teffTr1y9kp03aOcwAQRBLNPnI9_jCnZMHjViS7JJkuwUPvje2rBQ-cC2s-Uvh2x1afFs0RryW91K3CK3i-nCxXBO6hWtoudbGgxuV9MBBYKu45V4aDaYDDl3Q7fTUGu285VKjgOYVLP4XpEUXz1scPXTWDCC9A4Gd1DK-EyuIgODNXBQ6LpXUh3gwcN_24HscEtj30sGzsY8ORrQdtl69Qic1gtQwWnySJjh4Quuk0S7imtNxLWIGaI1AsEE74A6k9qgFioSkO5JWx2-2dSb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