<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/77189>77189</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Deducing `auto&` from `const int` in template parameters is impossible in partial specializations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Eisenwave
</td>
</tr>
</table>
<pre>
### Code to Reproduce
See https://godbolt.org/z/rhKsWKdPz .
```cpp
#include <type_traits>
template <auto& Value, int>
struct test : std::false_type {};
template <auto& Value>
struct test<Value, 0> : std::true_type {};
int main() {
static constexpr int v = 42;
static_assert(test<v, 0>::value); // error ?!
}
```
```none
<source>:11:19: error: static assertion failed due to requirement 'test<v, 0>::value'
11 | static_assert(test<v, 0>::value);
| ^~~~~~~~~~~~~~~~~
```
### Explanation
Clang is completely unable to deduce `auto&` in the partial specialization, leading to this failure. GCC accepts this code, as it should.
Note that replacing `auto&` with `const auto&` fixes this, but shouldn't be necessary.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE2P4zYM_TXMhdjAkRw7Pvgw4yQ9LFAULdAeB7LNxCpkyZWozMehv72QncnsTLeDYg3DQUT68T0-mioEfbZENWzvYbtfqciD8_VBB7KP6kKr1vXPNQi53Ni4npAd_kqTd33sCLI9ZHe_EeHAPAWQdyCOII5n17fO8Nr5M4jjC4ijH76GP772v7zgenkJimy5u2m6ngipbWdiTwiy4eeJHtgrzQHk4ZoxP5nGySies1RkB6LA35WJBKJBbfmWHtjHjpEpMIK8w8B9YijvTsoEekgVEMp7KPcg7_9fhe9Ag2xu1TOQh_el2MfPKmnLOCptQexAVHPOfI6IGFix7rBzNjA9TT5pwwuC3GMubjhvmQ8qBPIMYneldXmltFC5LCwrkPe42ITkvfMI8ghic6VV7j_48-GvdfZqO8gmuOg7WipsNulRJfUz7NKGWcJCTDuLJ6UN9djHeY48_RW1p5EsI4jyU9rlTe5mg1A2-EPC33qGN5D3F2wPf3-4vt-Q21dxeJqMsirpW0KNUfaMOmDnxskQk3nGaFVrZtE9pS8HociuowVFhtoiD4ST8qyVwTBRp5XRLwuqaNCQ6rU9JwAedJgbGT2t8aemQdV1NHFYIp3r51lUATVjGFw0_frbmfvZMSEPitHTZFSXYN-zedQ8pKN59PCbwEk_0VImVWjjK75N7mFLaKmjEJR_Xq_6WvaVrNSK6k2Z5VuZb0uxGuouK_KsbZXY5pXaqVNRblRbtkVedEWxo2qla5GJPNtkRVbllRTrIlNb2RZlWfaZlO0W8oxGpc3amMuYdsxKhxCpLsvNrloZ1ZIJ80oTwtIjzkEQIm04X6d3vrTxHCDPjA4c3lBYs6F6n_z5d09O3o1vPUlr5mrb666YlFcjMfmQrNfj5ELQyXNt_8PXsIre1B82p-YhtuvOjSCOidn158vk3Z_UMYjjrCeAOM56_wkAAP__XYO-oA">