<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56607>56607</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang GNU C mode error: redefinition of 'index' as different kind of symbol
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zufuliu
      </td>
    </tr>
</table>

<pre>
    for following C code (see https://godbolt.org/z/rc1bzrY3s, related to issue #16513):
```c
int index;

int get(void) {
        return index;
}
```

clang `-std=gnu99` emits an error:
```
<source>:1:5: error: redefinition of 'index' as different kind of symbol
int index;
    ^
<source>:1:5: note: unguarded header; consider using #ifdef guards or #pragma once
<source>:1:5: note: previous definition is here
<source>:4:9: warning: incompatible pointer to integer conversion returning 'char *(const char *, int)' from a function with result type 'int' [-Wint-conversion]
        return index;
               ^~~~~
1 warning and 1 error generated.
```
however `-std=gnu2x` is OK.

while gcc `-std=gnu99` emits a warning (also in `-std=gnu2x` mode):
```
<source>:1:5: warning: built-in function 'index' declared as non-function [-Wbuiltin-declaration-mismatch]
    1 | int index;
      |     ^~~~~
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVE1vnDAQ_TVwsViBvSzhwCHZTXqo1J6qqkeDB3Br7JU_dpP8-o4h3d2km6hSEQh_jMdv5r2Z1oinpjeW9EYpc5R6IFvSGQEkoTcOgIze713CbhP6gO9gRGuUXxk74OwZP9sV7bP9wVxCt8SC4h4E8YZI50J0wopNWbCE1tFHvkvy22STL2-3zKX2RGoBjwm7e7E4rQ_gEcfBSIEeSFKdDGoLPlj99mC1e3PHpcNOcQwPFzPnRcJ2gw51jVMCk_SOcE3AWmP_BvoyZVtngu0gYfdoU-BX4nc6hNEL6KWWXhpNTI_BVws8WhHuiJB9DxYwql-4HA3c04TZfC8LBJ-kvP_4cm08xH_QQ-BWYO5H4AIQzx3SqJ3EMQku8opcyB4RktnSESQdl_aWDxMnRqPrf7ppb-EgTcB4zsFKh9fa6w7W-EXyyZFbjTjiUOrOTHvuZauA7A3GjiijaHAw4BCRH8C66HrhecFfdSOPoFGMNzE4T84L23g4ygyT3VszEU76oLsZ3lH6ER25oDzxT3tYmPHRNCnvsu84zs5XJuXuTEB8rkqNvH4iUdXFO9sUf2JGbQlSLEpBTWuwsUxWV2U2miMgktc6pY9Rp5jmr59Xl5I-jhIzOHTdB7I-gcCsceVilq85n7Dor5bpx7K4YLUNUvkMvZ8Sf1kBArD-sERiKWijs7NRpGA-K3W2WPG4kU3STdx34ytCCuwCM9dX-Yh779JxiigVDRM1q3nqpVfQbOfG8OnLN-x9MQ3_XdJpsKp50zlRg6Fdoe5xotThzy_bW_MTOhTjw9wysY8-lJtNXqVjA3UtWM14xaubdcEY61vgXcGLjraspzRVvAXlGsxgQqmG49J1cYwpS2VDc0rzqqjzurxZb1ZtWW1EwRldl1VJ6SZZ5zBxqVYRR2zpqW1mSG0YHG4q6bw7b3Ln5KAB5uvQPw9-NLZ5Dn1QMqTz1c0M_TfFo-bm">