<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62706>62706</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
error when template is explicit instantiated with a class inside a namespace
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xiaoqiangwang
</td>
</tr>
</table>
<pre>
Verified with both clang-cl 14, 15 and 16, the first one gives an error while the second passes. MSVC would allow both cases. Also Xcode 14.1 (Apple clang-1400.0.29.202) shows no error.
```
namespace foo {
template <typename T>
class bar {
const T t;
};
}
// Error: explicit instantiation with a class with namespace
namespace spam {
class egg {};
template class foo::bar<spam::egg>; // explicit instantiation of 'bar' not in a namespace enclosing 'foo'
}
// OK: explicit instantiation with a bare class
class bacon {};
template class foo::bar<bacon>;
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU0FzqzgM_jXmoiljBITkwCFNm8vOzh6209mrwQK849g85DTtv39jIG3aea-PYcCy9FnfJ1mK2fSOqBblvSgfEnUOg5_qV6P8D6Ncf1GuTxqv3-pnmkxnSMPFhAEaHwZorXL9XWshKwQeICtBOQ3ZJhphIOjMxAG8I-jNCzEoBzRNfoLLYCzNIUytdxpGxUycwt__Ph_g4s9Wg7LWX9Y8anbuLXv4r_WaICvSDARu9-NoaeWRFVKmMsVdihIF7oAHf2FwfkmaCvkg5H79buT6zqZTJ-JRtQSd9yCq-2UbACDQabQqEIj8EN5GiqHwJPLHNaS1ihkaNX2Gxaf1jgM8QRD5jUdUD-92XN-ywqPAIzxGuiLfA72O1rQmgHEclAtGBePd0gC1Zp6Nd_5f5fCoTp-JLSjq-3n7hssnsUtU573I9yLfN2oS-SEettjU97EC-T2slH_D1HcgsIporMD56Ab1wRbItdazcX0Mi9mw-q4w__z156o0alrpL9Brf1rvvir-Xu0MWVR-uTOJrnO9y3cqoTrbbAu5w6oqkqEucdNl-Ra1bIqtlJSVCrddVupMbyVSl5gaJeayzIpsl2NZpJo2stPVrsVtUZBsRSHppIxNrX05pX7qE8N8pnqDldwkVjVkeR5VREcXmJ0CMU7uVEfMXXPuWRTSGg78cUowwVJ9HT5yH502_KuCXsf8esuMY6PptnfJebL1EMLIsWhzf3oThnOTtv4k8BhTr7-7cfL_UxsEHmfCLPA4C_oZAAD__77UY2Y">