<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/138078>138078</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang 20 regression: conflicting deduction 'type-parameter-0-0' against 'long' for parameter
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jeremy-rifkin
</td>
</tr>
</table>
<pre>
```cpp
#include <type_traits>
template <typename Integer, Integer C, unsigned I, template <typename, Integer, unsigned> class Trait, typename = void>
class Foo : public std::integral_constant<bool, true> {};
template <typename Integer, Integer C, unsigned I>
class Bar : public std::integral_constant<bool, Foo<Integer, C, I, Bar>::value> {};
template <typename Integer, Integer C>
class Bar<Integer, C, 0> : public std::false_type {};
template <typename Integer, unsigned I>
class Baz : public std::integral_constant<bool, Bar<Integer, 1, I>::value> {};
Baz<long, 20> x;
```
This ostensibly valid code compiles fine on gcc, msvc, and clang 19 but fails on clang 20 with the following error:
```cpp
<source>:6:20: error: conflicting deduction 'type-parameter-0-0' against 'long' for parameter
6 | template <typename Integer, Integer C, unsigned I>
| ^
<source>:7:68: note: template template argument has different template parameters than its corresponding template template parameter
7 | class Bar : public std::integral_constant<bool, Foo<Integer, C, I, Bar>::value> {};
| ^
<source>:3:97: note: previous template template parameter is here
3 | template <typename Integer, Integer C, unsigned I, template <typename, Integer, unsigned> class Trait, typename = void>
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
<source>:13:49: note: in instantiation of template class 'Bar<long, 1, 20>' requested here
13 | class Baz : public std::integral_constant<bool, Bar<Integer, 1, I>::value> {};
| ^
<source>:15:15: note: in instantiation of template class 'Baz<long, 20>' requested here
15 | Baz<long, 20> x;
| ^
```
https://godbolt.org/z/vjYsWPq3q
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVsFu4zYQ_Rr6MnAgkZJpH3Sw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