<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/134519>134519</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Spurious error when template template parameter substituted using a class template with an NTTP whose type is its first template parameter
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ednolan
</td>
</tr>
</table>
<pre>
Given the following code:
```cpp
template <typename Foo, template <typename, Foo> typename>
class Bar {};
template <typename Foo, Foo>
class Quux : public Bar<Foo, Quux> {};
static_assert(sizeof(Quux<int, 0>));
```
Clang 20.1.2 and trunk produce the following error:
```
foo.cpp:4:20: error: conflicting deduction 'type-parameter-0-0' against 'int' for parameter
4 | template <typename Foo, Foo>
| ^
foo.cpp:5:30: note: template template argument has different template parameters than its corresponding template template parameter
5 | class Quux : public Bar<Foo, Quux> {};
| ^
foo.cpp:1:58: note: previous template template parameter is here
1 | template <typename Foo, template <typename, Foo> typename>
| ~~~~~~~~~~~~~~~~~~~~~~~~ ^
foo.cpp:7:15: note: in instantiation of template class 'Quux<int, 0>' requested here
7 | static_assert(sizeof(Quux<int, 0>));
| ^
1 error generated.
```
Compiler explorer link: https://godbolt.org/z/5Mar9h7zE
The code is accepted by Clang 19, GCC, MSVC, and EDG.
Bisecting shows that this started with 28ad8978ee2054298d4198bf10c8cb68730af037.
CC @mizvekov
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVU1v4zYQ_TX0ZRCDoiRLOujgOPaetmixQa8FJY4sNjSpkpS9yaG_vRjJ66SJnaJLEKAtDh_nvfmgDEHvLWLN8nuWPyzkGHvna1TWGWkXjVPP9Rd9RAuxR-icMe6k7R5ap5Cla8anueLzbIeB8XXEw2BkRGDpJj4PaOUBYeccExu4tkffaTvdwuVTumV83RoZAtxLD6y4Z8UDS-_nCz-7YUa6nP5tHL8DS9cwjI3RLaGxdHO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