演示程序
#include<stdio.h>
int main(){
static int ia[2];
static volatile _Atomic (int *) a = (int *) (&ia[1]);
if ((a += (1)) != (int *) ((int *) (&ia[1]) + (1)))
printf("1");
}
编译失败
<source>:5:9: error: invalid operands to binary expression ('volatile _Atomic(int *)' and 'int')
5 | if ((a += (1)) != (int *) ((int *) (&ia[1]) + (1)))
| ~ ^ ~~~
1 error generated.
Compiler returned: 1
Gcc 没问题!
https://godbolt.org/z/fMqzoe4b5
clang 是否支持 _Atomic 指针算法