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

    <tr>
        <th>Summary</th>
        <td>
            Allow __restrict'ing in array size specification in C++, like C
        </td>
    </tr>

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

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

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

<pre>
    Unfortunately, C++ does not have the ever-so-useful `restrict` keyword of C. Fortunately, compilers such as clang++ offer a `__restrict` pseudo-keyword. Unfortunately, that keyword is only offered for pointers, not for array parameters. If we write:
```
int foo(int a[__restrict 10], int b[__restrict 10]) {
 a[0] += b[0];
    return a[0] + b[0];
}

int bar(int *a, int *b) {
    a[0] += b[0];
    return a[0] + b[0];
}

int baz(int * __restrict a, int * __restrict b) {
    a[0] += b[0];
    return a[0] + b[0];
}
```
then `baz()` will be accepted by clang++ as C++, but `foo()` [will not](https://godbolt.org/z/sK7eWGG9j) (GodBolt).

Well, `foo()` should be accepted! Taking array parameters is useful, especially if they are multi-dimensionsional. Without them,

See also this G++ bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97477


  [1]: https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VMtuwzYQ_Br6srAgU5ZlHXTwAwqKXoo-kGNAkSuJCUUafMSQv76grCRyUvTWAjZMc5ezw9lZMudkpxErkh9Jfl6x4HtjKxyZsua2aowYq790a6wPmnlUI6EnOBF6JPQIwqADbTz07B3B9wj4jnbtzDo4bIMCskstOm8l92SXwhuOV2MFmBZOCdSPoNwMF6nQOnCB98AccMV0N5cybYsWWER8eVliXhwGYdYzdAI_yPqe-c_K0oHRarzDoYDWWLgYqT1aF5PjZeIes5aNcGGWDRhjCfzSwhXhaqVHkh1IeibpgezS-TP9lToeNoTu44qR_PhFFTYpyc-xRIw1_xgrgRTHO9R0Ou5CvH92nk5MWdlHBgBY9MHqh9yfiaQ4z4tPkg2zM0lCD-yDFKGH5pEEwH_N4_bFAxaCLDkt9_8ffo9d9T3qaLs7WULL6LqrVAoaBMY5XjwKaMYHuzL3MSTxJk3wEeHujRmB5McJRBs_NX_fe39x0Vq0JrTujGiM8omxHaH1jdDa_Vrg89NT-TppQPdPRhyN8oSWyVLXZ1Qq1vxez_UmKLHkTOgG_mRvUnc_7B7n5D7CEQrdBblkSo0g2zjmIzCLMATl5VrIAbWTZvoylcCz9L0JPuYNhJ6W3P5ABKacAd9LB0-zVk3oPifqmwicJ50OswhN6G5SKRa16M31pQldwjtJsloKkp3LYlsUy2of_Sf5cTM1-gD_Bm-0khqF4e4eIrT-ffYdivVv8yOR9H5QK1FlosxKtsJqU9B8u8uyslj11b7EnchLvhGCsm0udhnjxT4t2zTluci2K1nRlG7TMt1ucpptioSnrGE7XjZtxvb7fUu2KQ5MqkSp9yEyW0nnAlabtKD5bqVYg8pNjzWlGq8wRQml8e22VTy0bkLnyDZV0nn3BeOlV1gdlDLXxUQRWsT-Sz1bwMkbwtTuVnLmpdExtrCykm8Ip1WwqvompvR9aBJuBkLrWHX-WV-secVYqZ64RnXny7xX9O8AAAD__-W08Ao">