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

    <tr>
        <th>Summary</th>
        <td>
            Template argument limit of 0x7fff in clang-21 onward
        </td>
    </tr>

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

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

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

<pre>
    I noticed that clang TOT fails to compile variadic templates with argument count exceeding 0x7fff.  I plugged a simple reproducer into [godbolt](https://godbolt.org/z/nq4q4djz7) and noticed that this behavior starts at clang-21 (i.e. clang-20 compiles successfully).

The simplest repro I came up with was to simply instantiate a `std::index_sequence` at various sizes, where the first `static_assert()` succeeds and the second one fails:
```
namespace std {
typedef int a;
template <typename b, b... c> struct d {
  constexpr a size() { return sizeof...(c); }
};
template <typename b, b e> using f = __make_integer_seq<d, b, e>;
template <a e> using make_index_sequence = f<a, e>;
} // namespace std
int main() {
  constexpr unsigned SeqLength = 0x7fff;
  std::make_index_sequence<SeqLength> Seq;
 static_assert(Seq.size() == SeqLength);
  {
    constexpr unsigned SeqLength = 0x8000;
    std::make_index_sequence<SeqLength> Seq;
 static_assert(Seq.size() == SeqLength);
  }
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVE9v-zYM_TTKhfgZsuTEzsGHtFmAAgN2aO-FLNG2OltyJLpp-ukHOUn_bcB2GxDEgMRHPj4-UcVoO4dYs_UdW-9Xaqbeh_pFjRhP06DOGFaNN-f6AZwnq9EA9YpAD8p18PTHE7TKDhHIg_bjZAeEVxWsMlYD4TgNijDCyVIPKnTziI5A-9kR4JtGNNZ1wN_Ktm0zgAeYhrnr0ICCaMdpQAg4BW9mjQGsIw9sfdd50_iB2HrPRNUTTZHJHRMHJg7Xq8yHjonDOxMHdyyOhXl5L5nYgnLmexfU2wgN9urV-gCRVK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