Issue |
96391
|
Summary |
clang: overload of operator** and operator[] seems to work everywhere except ARMv7
|
Labels |
clang
|
Assignees |
|
Reporter |
jcelerier
|
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.
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs