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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Wrong parsing in _constant-expression_ for bit-field size
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    The following program is well-formed:

```
int i;
struct A {
 int b : 1 ? 1 : i = {} = 0;
};
int main() {}
```

 The grammar for _assignment-expression_ does not permit `{}` on the left-hand side of `=`, therefore the last `= 0` cannot be part of the _constant-expression_ and must instead be the _brace-or-equal-initializer_ of the bit-field.

Clang fails to compile this (https://godbolt.org/z/d6rb9no9x):
```
<source>:3:28: error: initializer list cannot be used on the left hand side of operator '='
 3 |     int b : 1 ? 1 : i = {} = 0;
      |                         ~~ ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU8FymzAQ_ZrlsoNHSMbAgYNjhy_oTI8eAYutVkhUEkmaQ769I0yc1JMeqmGEBG9XT-_tSu_V2RDVkD9AfkzkHC7W1T9JmUHPlLS2_11_uxAOVmv7rMwZJ2fPTo6oPD6T1ulg3Ug9iD2wI7D3ecfWZ9kqE1CBeLjufHBzF3CPUKxfMAJaBLHHDEE0y7xHhSCOC6o4Lkt2ywHF8baOwaNUBngJvFrxX_JYT4sXincYpcPBOjxdZRjJhJReJkfeK2tO2FvyaGzAidyoAsY81-Q7htZguBBqGkJ6kaZHr3pCOywoESHADxHiaLCOrmDpw_ofIyvspIn5W8JJuhCjI-zUWeODvGMTzxhnH1AZH0j2MWpBt052lFqX0q9Z6lQZFZTU6pXc6T1jq0I6KNL95rMQBy3NGQeptMdgsbPjpHRMqjwCLy8hTD4ayxvgzdn2rdVhY90ZePMKvOl3rq2MrV6AVx_-3ykuDt7OriMQjyD2AsSel9Fbcs66xeQPuqiVD580mT31n3XGv3S2EzkZrEPgRRScF6u9AqE4YBz_XVZL1C38q_H2hpA_3t016WvRV6KSCdVZwfNsWwlWJZdadNVAWcv5wGnXVqzKO1H2sh-6vhBZTomqOeNbVrGMMVbyaiPKbpvJdlcIQSVrc9gyGqXSG62fxih-oryfqc7YriyqRMuWtH9vX1dHVNrOZw9bFtX0H3FBBb00ehdth_yI352NDS2dj42tzD8KL7bIrYDQq1dKZqfru_JQ4TK3m86OwJt45vpKJ2d_UBeANwtxD7xZuT_V_E8AAAD__8Q8V40">