<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/102320>102320</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-18 regression] Compile error in out-of-line definition of constrained class template nested in a class template
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ozaktash
</td>
</tr>
</table>
<pre>
The following code doesn't compile on Clang 18 and further:
```cpp
template<typename>
concept Constrained = true;
template <typename T>
class C
{
template<Constrained>
class D;
};
template <typename T>
template <Constrained>
class C<T>::D
{
};
```
With the following message:
```
<source>:12:11: error: type constraint differs in template redeclaration
12 | template <Constrained>
| ^
<source>:7:14: note: previous template declaration is here
7 | template<Constrained>
| ^
1 error generated.
```
It compiles with Clang 17, GCC and MSVC (https://godbolt.org/z/r65o8sPjs).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE1vpDgQ_TXmUuqWsaGBA4cOnV7tYaWVNto5u3EBzrhtZJtEya8fGUh_ZCJFYyEjU1S9V69cJbxXvUGsSf5A8kMipjBYV9t38TMIPyQnK9_qpwGhs1rbV2V6aK1EkBa9IawI0NrzqDSCNdBoYXpISxBGQje5MKAjfE_ogdA92dHlacdx-RLwPGoRkPAmvI1oxBkJf1xsrTUtjgEaa3xwQhmUQPgBgpuQ8Ic15F0YuIkDT9dIWngPzepRrK5wA36DcfECAFg8D1e44vBn0Lfmr0A-qPFm9uF7wveHT0TvQD8kXI4_VBgg3NXmjN6LHn8XfT3yxtvJtbjApSxuKeF7QOdsrBXENKD9IBtAqq5D50GZi2TgUGKrhRNBWXPRK2VAiga-SxrmFf8k-eOXtIrIKotkjI0F2sPo8EXZyV-D3xAA5WFAh9fwxR2Rb3ncrQupdNEEejToREC5_VrSef_70gceXmNZ1lYoCGvgr6aZO-Kf__5vgLByCGH0sUTsSNixt_Jkddha1xN2fCfs6Ha5Lf2_z56wagVNZM1lxSuRYJ0WjNOMlZwmQ10UnGVdV5WSYtZxrKpTK_muKotCYJ6yRNWMsoyWtEhzStluKypZ5jmVIj9VPNvtSEbxLJTeav1yjiwS5f2EdUoZZzTR4oTaz-OBMYOvMFsJY3FauDo6bU5T70lGtfLBX8MEFfQ8V9qoxSYtwWHv0Pt4afIDNOvgWGRWBuwUNrbbaGVifTtl1Fxe213vI8q1Ky8XwaAPKKO7-GRKJqfrT1qrMEynbWvPhB0j0fW1GZ19xjYQdpzT84Qd1_xfavYrAAD__74ojTU">