<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96391>96391</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang: overload of operator** and operator[] seems to work everywhere except ARMv7
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jcelerier
</td>
</tr>
</table>
<pre>
Repro :
https://gcc.godbolt.org/z/W6zsYexr3
```cpp
#include <cstddef>
struct foo
{
operator float**();
float* operator[](size_t i);
};
int main()
{
foo x;
x[0];
};
```
expected: code builds
actual:
```
<source>:12:6: error: use of overloaded operator '[]' is ambiguous (with operand types 'foo' and 'int')
12 | x[0];
| ~^~
<source>:6:11: note: candidate function
6 | float* operator[](size_t i);
| ^
<source>:12:6: note: built-in candidate operator[](float **, int)
12 | x[0];
| ^
<source>:12:6: note: built-in candidate operator[](float *const *, int)
<source>:12:6: note: built-in candidate operator[](float *__restrict *, int)
<source>:12:6: note: built-in candidate operator[](float *const __restrict *, int)
<source>:12:6: note: built-in candidate operator[](float *volatile *, int)
<source>:12:6: note: built-in candidate operator[](float *const volatile *, int)
<source>:12:6: note: built-in candidate operator[](float *volatile __restrict *, int)
<source>:12:6: note: built-in candidate operator[](float *const volatile __restrict *, int)
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vctu6zYQ_RpqM4ghDWU9Flo4D--6uZuiq4AixzJvaVEgKcfJ4n57QcmvxAHaAq0Jgaap4TlnzghD4b3ueqKGLR_Z8jkRY9ha1_yUZMhpcklr1XvzgwZngfEVS59Zepy3IQw-7uGa4bqTctFZ1VoTFtZ1DNcfDNe_Fx_-Dzo4fn3wOBfp_MhhOO4g1700oyJg_En6oBRtGH-5PuWDG2WAjbXH3fJxXgCAHciJYB1sjBWB4Wp6KoY145eo08tz-Jw5w8rrD3oNoK8PsPL5sp5m3QfYCd3PyHArI4qDw4XywJaPaWT4FvPkwjUFHQaSgRTjK5BWEbSjNspfhwgZRmEuFfkCw5-8HZ2k6B5fZcj4qoho5Jx1cTF6ArsBuydnrFCkLu4xLE-WlKA9iF2ru9GOHhhWbzps59BeQXgfKO6WsRxYQtxjWOo-RAysz5ZkCKx8unUCphFfxfGLLV9-fZtA1J5lUXdvA022iF5pJQLBZuxl0La_IBYnxH9X6s9ijv-WL3_j6ElQLFF40P2VshvWSQ-cPswnmIy6cSmOW6fOuv4nSdL2_qjts7D_lub11ZEPTss7cM0p3ZNxb40I2tC9crsf35np_gX8h9TZ3Nygoz7ikVp8aY2JariqeS0SarIyq9MCyypLts1GYFpUvGw5tULxIm_zuqrzZVmpthVtm-gGU8zTAjHjWGC2oLxOl4rzPC3zqqpSlqe0E9osjNnv4vWXaO9HauqC11liREvGTzcsojSi7xhivGxdE-Mf2rHzLE-N9sFfEIIOhpo5nK_OnXrq2ifHpk4ytd3PJoIn2nkIFt6s-xNoT-79bUuOgA6ShgCrH7_ty2R0pvlyi-uwHduFtDuG6yjl-PMwOPuTZGC4njLzDNdzcvsG_woAAP__iFJlGA">