<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124913>124913</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Syntax error for overloaded operator[] in 32-bit address space
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ararmine
</td>
</tr>
</table>
<pre>
**x86-64 clang 19.1.0** issues a compilation error for the following example:
1. cat ex.cpp
```
struct value {
public:
operator int() const;
struct value &operator[](const char * __ptr32 _param_1);
};
extern struct value *new_value();
int json_send_error(int status)
{
struct value * v = new_value();
(void)(*v)["error"];
return 0;
}
```
2. clang ex.c -fms-extensions -S
```
ex.cpp:13:13: error: use of overloaded operator '[]' is ambiguous (with operand types 'struct value' and 'const char[6]')
13 | (void)(*v)["error"];
| ~~~~^~~~~~~~
ex.xpp:5:23: note: candidate function
5 | struct value &operator[](const char * __ptr32 _param_1);
| ^
ex.cpp:13:13: note: built-in candidate operator[](long, const char *)
13 | (void)(*v)["error"];
| ^
1 error generated.
```
https://godbolt.org/z/dbvEGfz13
**x64 MSVC v.19** compiles successfully https://godbolt.org/z/qWc584f5f
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVU2P6yYU_TV4cxXLxsYfCy-cmUlXXY3ULiMMOOGJgAvYk3mL_PaK4DSTvFdVlR6KEoLvPZxzLlxT5-RBC9EhskXkNaGzPxrbUUvtSWqRDIZ_dgj3CPfnptpUJTBF9QHyNs3TLD4A6dwsHFBg5jRJRb00GoS1xsJoLPijgNEoZT6kPoA409OkBCp6lPV5Cox6EOeUTRPKelRl6yfrnbcz87BQNQtA9RZlPUzzoCSLubAOMwlLvbEgtUe4QbgFZrTzqNh-iXpEw9UtK-pGuLnmADtSC0HTfj95W2DYT9TS0z5HuI2AqH5dJ1kvzl5Y_Yzda_Gxv_6JdP4Jl9rDN2f03gnN91eDEG7Cqv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