<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54352>54352</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
An explicit specialization declaration shall not be a friend declaration
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
namniav
</td>
</tr>
</table>
<pre>
[n4861-temp.expl.spec](https://timsong-cpp.github.io/cppwp/n4861/temp.expl.spec#20)
> An explicit specialization declaration shall not be a friend declaration.
Clang compiles this code:
https://godbolt.org/z/eeah47bvb
```c++
template<int N>
consteval int foo();
template<int N>
struct Foo {
friend consteval
int foo<N>() {
return 1;
}
};
struct Bar {
friend consteval
int foo<1>() {
return 2;
}
};
int main() {
Foo<0> f;
return foo<0>() + foo<1>();
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytU92ymyAQfhq9YeIomKgXXuSnuew7LLoqHQIOYNqepy8YzTE9k17VQWH_vv0Wd7luf9fR_qTy8pDtHN7GBH-NMrEjNtH-EtFycG60ETtG9OqXEzerVb9rxjHphRsmngjt9V7-Ofp9xgl-r0iU0TSiVZReovQYsW_kqEiwikY4EjwESPEBTmhFWmwkmMfZDiAlUdoRjgRIZwSqduuRLJDz9yxB9aTRt1FItMQNwnqpxcB-dnitpdct19Il2vRe-vAvIgx5we98QT2kj-ULOIU1a0NpEpxHPQvlyHdfzsPQaGUd3kGSoO-0v5cyFM1OW5Jvw60zU-PIVWsSFUsIWUt-Yq_6NQU7zwhzpm1ceAy6ySiSPRkQ73FZyPjDK7El_wnMK847BlsO2VsOTxZ0w-KfPALqDYT6inedc6Whf7oN2pKge1rXSHr6Qu8z15PA-pPjtmZtxSqInXAS6__VovFkZP1X5z0mx3eqF6S8r9tuNPoHNs6LwtoJrT_sc7an8VAXB8ZzeoC8oliUvOy6kudAocMuwwIPsQSO0oZh9oMbi5qmlKYso1meFjlLqqzKkLXAixZpCSzKU_TXLJOQOMxAbOqZA596641SWGc_jWCt6BXiig-TG7SpFdyUgHs8061nrn8AJiVGPw">