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

    <tr>
        <th>Summary</th>
        <td>
            clang does not implement `__assume__` attribute, fails libstdc++ build
        </td>
    </tr>

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

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

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

<pre>
    `gcc` implements `__assume__` attribute as: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html, quoting the example:

```c
int
foo (int x, int y)
{
 __attribute__((assume(x == 42)));
  __attribute__((assume(++y == 43)));
  return x + y;
}
```

`clang-16` fails to build it as:

```
$ clang -c a.c
a.c:4:18: error: 'assume' attribute cannot be applied to a statement
  __attribute__((assume(x == 42)));
 ^                ~
a.c:5:18: error: 'assume' attribute cannot be applied to a statement
  __attribute__((assume(++y == 43)));
 ^                  ~
2 errors generated.
```

Recently `gcc` started using it in `libstdc++` https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e39b3e02c27bd7 as

```c++
    void
    _M_assume_normalized() const
    {
 unsigned int __ofst = _M_offset;
      __attribute__ ((__assume__ (__ofst < unsigned(_S_word_bit))));
    }
```

and `clang++` now fails to parse `<vector>` from `libstdc++`.

Is there a change `clang` would support this style of `__assume__` attribute or at least skipped it in stead of producing build failure?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vc2O6ygTfRqyKSVyIInthRedzo30Lb7N3AewMJQdZjB4oNzdmcU8-wg7f9OKoruayIrBwKHqHE4hYzSdQ6zYds-2h4Uc6eRDRcG3ZtF4fa7YLuuUYrsMTD9Y7NFRBLbL6lrGOPZY12lMEgXTjIQgIxNvcCIaUoPxI-PHTqlV58aVDx3jR--scai9ivMQ48efJGmCXr5dgeLqRL1l_B3-HD0Z1wGdEPBLpigScnZg2fV_l82Pmv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