<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63837>63837</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Concept-constrained non-type template parameter pack in a member template of a class template causes a crash
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jiriklepl
</td>
</tr>
</table>
<pre>
Simple code to reproduce the bug [https://godbolt.org/z/97PKnxeqP](https://godbolt.org/z/97PKnxeqP):
```cpp
template<class T>
concept IsFoo = true;
template<class>
struct Struct {
template<IsFoo auto... xs>
void method() {}
};
template void Struct<void>::method<>();
```
The crash happens on all currently available versions capable of interpreting constraints.
The actual template parameters of the template installation do not matter, I have chosen the simplest ones.
The code is interpreted correctly by the latest [GCC](https://godbolt.org/z/z7McMjzrj) and [MSVC](https://godbolt.org/z/968W13hEq).
---
A very similar code with equivalent semantics that doesn't cause the crash [https://godbolt.org/z/efG5cnqMn](https://godbolt.org/z/efG5cnqMn):
```cpp
template<class T>
concept IsFoo = true;
template<class>
struct Struct {
template<auto... xs> requires (... && IsFoo<decltype(xs)>)
void method() {}
};
template void Struct<void>::method<>();
```
The above example could lead to an assumption that the crash is caused by `IsFoo auto` simply appearing in a parameter pack, but that does not seem to be the case as the following simplification of the code, again, is interpreted as expected [https://godbolt.org/z/eYE995q54](https://godbolt.org/z/eYE995q54):
```cpp
template<class T>
concept IsFoo = true;
struct Struct {
template<IsFoo auto... xs>
void method() {}
};
template void Struct::method<>();
```
---
The following example demonstrates that bug is not limited to methods [https://godbolt.org/z/GxKd85r7c](https://godbolt.org/z/GxKd85r7c):
```cpp
template<class T>
concept IsFoo = true;
template<class>
struct Struct {
template<IsFoo auto... xs>
static constexpr int field = 0;
};
template constexpr int Struct<void>::field<>;
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVl9vo7oT_TTOyygRMfkDDzy0S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