<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58059>58059</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Cannot inherit `const &` qualified overloads from base class
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
h-2
</td>
</tr>
</table>
<pre>
```c++
#include <string>
#include <vector>
#include <concepts>
struct S
{
int operator()(auto) const &
{
return 3;
}
};
struct S2 : S
{
using S::operator();
int operator()(std::integral auto) const &
{
return 4;
}
};
int main()
{
std::string str = "foo";
S2 s2;
s2(str);
}
```
This fails to build, because the base class's overload is not evaluated for the string argument.
Any of the following will make it build:
1. remove the operator in the derived class entirely
2. make the operator non-generic (e.g. replace `std::integral auto` with `int`)
3. remove the `const &` qualification from either the operator in the base class, or the derived class
Tested with clang-15.0.0 and 16.0.0-++20220929042300+b55e76de8bcf-1~exp1~20220929042408.451
The code works in GCC.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVNu2myAQ_Rp8YcWFeIk--JDLOf2A9gcQ0dBDIAXM6fn7Dl6S2CYvdbEUHGZm7z0DjWm_alSQaXBE92GQIyI7RFOpuRpagVF6cN5K3aP07ZnxKrg39oWRG83Fxbu7eXxDwIF7_H3-t52zYnik9thchGUhKC0RreDNBm9ghiGc8xjR4r5_5RweK_xgNU5Run_cdVxyHW-GNRYKeHdPIQ0O2IMl3cH4C9s61ksCzreTO1hFb5nC_0Epe0HpBbHpHeCcmdQzlH_Z3aBNVYa1BSWOAIl2BiDSJxxBLEdXaGAZWNqVJjeES489xvlxkg53TCqHvcHNIFWL6AE3grPBCexPAjcMJlwx5xDdOmyuwirDWgyO2ngsrkwNzIsWd8aODjMFZvvhLLSPp0w7_YVNN27ojFLmM-z5lEqBMB8CSz9nT2dkSQyKnyHb6LLUEgo7rlth5RVyjrgwZJFWqK_Jk8ZTyJWfNnrTCw1uHEQtRdyH-BfFOByRgrxojYIARH8KO8AQtFuql67ghZN7ayFw-jUwJTvJmZdG486aMxYQR9inZB4VPuBZxRXDVcmEC2qPuMCo-02SxyQmmOkWJ0WYbqZbhBJKSUUrktGUAPR9k-diW7SibHi3SdD2Tfy-hM_DxoyUcZYn6x4BdAaukk9jP1wA_e1wmKsaiTopiizbkqQoo7ZO2yqtWOSlV6I-MB06RGogDvV9IRJwWXrKTVLd9YgGq-qT9xcXqkPfYfTAe2hibs6wUOq6fDYXa37CLQhL6dwgQMv3vCR5FZ3qknRpyRlLeZaVXcGzZFsVNCdZTrs2IU2kWCOUq1G-R_kxkvUiSFJkFS3jIucFzUAWnrQFoxnKiIDjrOKQODa2j2w9YmiG3oFRSefd3QhEZK-FWOJDa52MrU8bGo1Q6xHnH538wA0">