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

    <tr>
        <th>Summary</th>
        <td>
            __auto_type(/C23 auto) allows restricting anything, and it sticks!
        </td>
    </tr>

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

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

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

<pre>
    https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf page 120 (6.7.4 Type qualifiers, Constraints):
> Types other than pointer types whose referenced type is an object  type and (possibly multi-dimensional) array types with such pointer types as element type shall not be restrict-qualified.

Thus: `int *` can be restricted, but `int` can't.

Using `__auto_type` here to trigger type inference (using `auto` produces "error: restrict requires a pointer or reference ('auto' is invalid)" which is identical to the error you get if you use `int`, which implies to me that `auto`, even in C23 mode, is actually `auto-storage-duration int` at present):
```c
restrict __auto_type x = 0;
_Static_assert(_Generic(&x, int *: 1, default: 0));
```
yields
```
$ cc -std=c23 a.c -c
a.c:2:16: error: static assertion failed
    2 | _Static_assert(_Generic(&x, int *: 1, default: 0));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
which means that, indeed, `x` is of type `restrict int`, which is forbidden.

Debian clang version 19.0.0 (++20240422112300+a2692ac23f14-1\~exp1\~20240422112407.665).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVc1y4zYMfhr6grGGgmTZPviQn3UfoNuzhyIhiSlNakkqjnvYZ-9Acpxk25leqslEJvUB-PARAFVKtvdEB7F5FJvnlZryEOLBq9a-KP2Xows5u2qDuR6GnMckqgeBR4HHy-VShJH8OmVThNgLPL5kXQo8Jo3IgL6sF5zAowk6CTz6ClEWo-lgVD1BiRIE7ppiW9Tw_ToS_JiUs52lmAQ-wVPwKUdlfU4C9xxaPgv5IKpv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