<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70648>70648</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Public member alias template cannot access private member
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JankoDedic
</td>
</tr>
</table>
<pre>
Clang 17.0.1 gives an error when compiling the following example (GCC and MSVC accept it):
```cpp
class S
{
template <class T>
static T foo();
public:
using A = decltype(foo<int>());
template <class T>
using B = decltype(foo<T>());
};
S::A f(); // ok
S::B<int> g(); // not ok
```
Godbolt link: https://godbolt.org/z/oE11bY6zh
Full error:
```
<source>:13:24: error: 'foo' is a private member of 'S'
13 | using B = decltype(foo<T>());
| ^~~~~~
<source>:7:14: note: implicitly declared private here
7 | static T foo();
| ^
1 error generated.
Compiler returned: 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE9v_CYQ_TT4MvqtDKz_7MEHrzf-SZUqVdqoUo8Yz9o02FiAkyaHfvYK29lNNlErFa0Ww8y89xhmEM6pbkQsSHIkySkSs--NLX4R45M5Yatk1Jj2tai0GDug2S7eUejUMzoQI6C1xsJLjyNIM0xKq7ED3yNcjNbmJazwLzFMGoGw_GdVgRhb-PX8ewVCSpw8KE_YgfCSxCcSlySN15-cpnVHauEcnDdzdlw_wOMwaeERCK9Wl0fCHzYjADgvvJLwCBdjCMsXji12_Z_mRit5JQ4xswt6SyD8BC1K7V8nJCwPCLxSow8EK9QXtBD-X5JW-OP38I_fg2enO6JzUMzLEi7XUwFhNWE1mKdPLseraOi--I7GX_2vOf_I89O0jdEetBqfCC-h935yAXiJ71brztiOsPqNsNo8UNr8kb71H0HqWeu1RL5e8LbklTOzlRiOz0vKCS_ZPhC-hwFh2XKHGSgHAiarnkOSBxwatGAuweFMWLYlmnIgWQX_M-FL3AJAkoe_w_hWZxa0LjJH4zHMapi0ksrr14VKWGyvUnu0eIPPFvh_qc-bhk-DJFst0a3rOhzRCo_tbt2vlgZECxb9bEdsgy56l_aoLXh74AcRYUHTQ56mCU1Y1Bc5yygTWZulXFIpEp438iJlmu4ZTWjLIlWwmHEa85hSliRsl1LWJJjHTZ4h0liQfYyDUHqn9fMQSiNSzs1YZHG6zyMtGtRueWQYG_EFFiNhLLw5tggxP5q5c2Qfa-W8u6F45TUWvy39-n7tQivhbh0nxRgqOjwpzt2VSDRbXdyVr_L93OykGQirA882_Zis-ROlJ6xe1DnC6kX9PwEAAP__eJx2GQ">