<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/66604>66604</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] templated functions with non-public visibility invoked by templated using declarations fail to compile
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
8ightfold
</td>
</tr>
</table>
<pre>
The following fails to compile on (to my knowledge) all versions of Clang, but works on GCC/MSVC. It only affects templated functions invoked by template ``using`` declarations where the invocation depends on the ``using``s type.
Godbolt: https://godbolt.org/z/Gdq8q7WWc
```cpp
struct X {
private:
template <typename>
static constexpr int foo();
public:
template <typename U>
using bar = decltype(foo<U>());
};
using type = X::bar<float>;
```
```
<source>:8:26: error: 'foo' is a private member of 'X'
using bar = decltype(foo<U>());
^~~~~~
<source>:12:17: note: in instantiation of template type alias 'bar' requested here
using type = X::bar<float>;
^
<source>:4:26: note: declared private here
static constexpr int foo();
^
1 error generated.
```
This affects bound member functions as well, and ``constexpr``ness has no affect.
I have confirmed this to be an issue as of ``clang version 16.0.2``, and affects all c++ standards.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVcuS4yYU_Rq8udUqGdl6LLTwY9w1i6wyyfQWwZVEGoEakB1nkW9PIfyaiVOpZLzA4nHPPZwLB-ac7DRiTdZbst4v2OR7Y-tSdr1vjRKLxohz_aVHaI1S5iR1By2TyoE3wM0wSoVgNBBaegPDGd61OSkUHRJaAVMKjmidNNqBaWGnmO4I3UEzeTgZ--5C7OtuR-jhp59_3SUAnz0Yrc7A2ha5d-BxGBXzKKCdNPczktRH844CmvNtGkiekjydnNRd_ASBXDHLYsipR4vge5yD-TwKAkfUYuYQZv4G4cCfR0xIuifpJravRjRGeZJtoPd-dCTbEHog9NDFicTYjtDDH4QeXsVH-VF8_cof4yMwyVM-jnHEeTtxD29Aim0cGa08Mo8Beu4DwM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