<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/102314>102314</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang refuses to match dependent reference non-type template parameter in partial specialization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Rush10233
</td>
</tr>
</table>
<pre>
The following code used to be accepted but is now rejected after clang-16:
```c++
template<int, class T, T> struct S;
template<class T, T A> struct S<0, T, A> {};
int i;
S<0, int*, &i> r; // OK
S<0, int&, i> s;
```
The diagnostic shows that `template<class T, T A> struct S<0, T, A> {};` is not chosen for the instantiation of `S<0, int&, i> s;`.
```c++
<source>:5:15: error: implicit instantiation of undefined template 'S<0, int &, i>'
5 | S<0, int&, i> s;
| ^
<source>:1:34: note: template is declared here
1 | template<int, class T, T> struct S;
| ^
1 error generated.
```
I'm not sure but it seems that implicit conversions like `int & A=i` should be taken into consideration. Note that non-type dependent pointer argument can be successfully matched as shown in the fourth line of the test.
GCC and MSVC accept the code.
[https://godbolt.org/z/jcMP8938e](https://godbolt.org/z/jcMP8938e)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVd1u4zYTfRr6ZhCDIi3JvtCFf-IPH4pti27Qe4ocWdylSIGkEmSfvhjJtZNusC1aQ5BJen7OzBweq5TsxSM2rDyw8rRSU-5DbH6bUl9wIeWqDea1eeoRuuBceLH-AjoYhCmhgRygRVBa45jRQDtlsAl8eIGIX1DTmeoyRtBO-ctDUTG5Z_zE-J_vii-PZuJAz3yacRidysjk0frMxJHcU4InWj4x-Qgpx0ln-Mzk9y5vbWH_3vrIlxDiuPzC6gOrT7co1mewt93NfgaxpxUTlSW_yOQBgIkzE2f45aeP7Kt5Nae_RbyVu2ypq8aqiw8pWw2pDy8Jcq8ysIr_54oqvswig-5DQg9diJB7BOtTVj5blW3wEDrK9kPsFV___d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