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

    <tr>
        <th>Summary</th>
        <td>
            [clang] unexpected syntax error when __builtin_offsetof uses array dereference on member
        </td>
    </tr>

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

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

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

<pre>
    The last line in the following code is accepted by `gcc` but rejected by `clang`, although the same syntax is accepted for assignment even by `clang`.
```c
typedef struct {
  struct s {
    int i;
  } foo[1];
} my_t;

void access_both_works(my_t *m) {
  m->foo->i = 0;
  m->foo[0].i = 2;
}

int works_with_gcc_and_clang() { return __builtin_offsetof(my_t, foo[0].i); }
int does_not_work_with_clang() { return __builtin_offsetof(my_t, foo->i); }
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydk82SoyAQx58GL12TUhyTePCQ2WyeYO8WYKvMIqQAk8nbb6v5cKf2tFUI0q39-zfdSNfcql89ghEhgtEWQVuIZGidMe6qbQfKNWQNIJTCc8QG5A3YNu2UohnkGMHjJ6qXRxlhO1oZ_wHCxN6NXT_HDGKg6Waj-PorYOs8iBB0Zwe0EfCC9luoDUuPLD1MQeehln28nbHBFkL0o4rAdh-LHR6WsLYB5RZBs_xpYbsjwR0rPjJWHJ-OyTzc6vgyzPPF6WYWHUItXezrq_O_A-P76Vtg_DAwXq6BwxvLf1L8adHA8iOkK_jDS_SU6JvlC75WsaZP2mdgfdXEpuOvhW3q5YT4_o6mWsTRW6hrOWoTta1d2waMrr3rnIqyhtJ_RIQnbMI0DkNtXZwTXHD_iZkz_454VjFpqrwp81IkUUeDFYlaOMURRotf56Wr7h2D3lOfXHv8FxbGgNRR3osbNOixpccqBGdhwEGiT0Zvqj7Gc2D5gfETjY4SG-VGOarbyZjLY3k7ezc1NG11CCNSiU_Flu_KpK_2pVSy5GmWiWxflrJo5I5nTY58l6VtmSVGSDRhSoVxbvEKcwh6p6QSXfGU83TLS3qyotxkgvNWqH1RFBlX7yl7T3EQ2mwmHRvnu8RXsyQ5doGcRocYXs7l0uB8clN8MdJt85XoXIjOekd5x2QWUM0J_AHYxTjz">