<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/134959>134959</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
accepts-invalid accessing private member of C++ class from scope specifier
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
efriedma-quic
</td>
</tr>
</table>
<pre>
```
template<int x> class A { static const int xx = 3; template<int y> class B; };
template<int x> template<int y> class A<x>::B { };
template<typename T> T f();
template<> int A<1>::B<A<1>::xx>::* f(){return nullptr;}
```
clang accepts.
gcc produces:
```
<source>: In function 'T f() [with T = int A<1>::B<3>::*]':
<source>:4:22: error: 'template<int y> class A<1>::B' is private within this context
4 | template<> int A<1>::B<A<1>::xx>::* f(){return nullptr;}
| ^
<source>:1:74: note: declared private here
1 | template<int x> class A { static const int xx = 3; template<int y> class B; };
| ^
<source>:4:30: error: 'const int A<1>::xx' is private within this context
4 | template<> int A<1>::B<A<1>::xx>::* f(){return nullptr;}
| ^~
<source>:1:44: note: declared private here
1 | template<int x> class A { static const int xx = 3; template<int y> class B; };
| ^~
```
I think clang is accidentally suppressing the access checks while disambiguating between a template function and a template member.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVU2PozgQ_TXFpdQRsXEcDhwg6Uhz7z9gTCV4xxjWNv1xmd--Ms12-iOztx01ipTIdr336r1QViGYiyOqQDQgjpmaYz_6is7eUDeou79no7N27F4q2OXrJ68jDZNVkYAfjIv4DPwetVUhYI0gGwxRRaNRjy5EXE48I_AjcuANfip-uRY3aRvkEXjzG5Lf19bAD-kI8Bp43SwybkHFl4mcGggfUu0DnoHtgZVfzqXdRJFwt1dc4IePK89XUmD1G5xsPMXZO3SztVP0CV8eIa_f2wh5ra1yF1Ra0xTD5nXtojVOfuxmTSHBLosf6vghjLPX9EqNPxyeZ6ejGR0Ck29NIYjmycQeHxb3b7fD3-sHcQQmV9KPLAXwmrFER96PPv0AJv87kPdMTKIJOHnzqCJhkmUcxt6E9DeJ9BwhrxERCwR5wD-QBC5PIrv5gLj_asIWeC2TE-jGJK7GjrRVnrq3znrytKJvP7fy_70s12Zu6k6Sef45vCvlFye_cVog7n_dTqb49sn8-joBfiRb3U98nQQmpGFgOnJRWfuCYZ4mTyEYd8HY0zIpQkDdk_4Z8Kk3lrAzQQ2tucwqpmMtxScih-pN4nU6KNe9Xx9oaMlvsq7iXclLlVG1lUWxFaXkMuurvdjyXakKJqiQipVqx_dl2crdnuVnlu8yU7GcibzIyzwv9kJuFD8L0apckpBCsBaKnAZl7Mbax2Ez-ktmQpip2vKiFGVmVUs2LJcPY46ecNkFxtJd5KtUdNfOlwBFbk2I4QoTTbRUrYPzzrhHZU232pNc-Df01xZxPOMBWAOsWUM6-3HAoMeJMEykzdmQz2Zvqz7GaRm77ATsdDGxn9uNHgdgp0S-ft1NfvyLdAR2WiQHYKe1p8eK_RMAAP__HbslAQ">