Is applying _Atomic
type qualifier to an incomplete type valid?
Example:
_Atomic void* p;
_Atomic struct S* p1;
_Atomic struct S x;
struct S { int i; };
Invocations:
$ gcc t0.c -std=c11 -pedantic -Wall -Wextra -c
<nothing>
$ clang t0.c -std=c11 -pedantic -Wall -Wextra -c
<source>:1:1: error: _Atomic cannot be applied to incomplete type 'void'
<source>:2:1: error: _Atomic cannot be applied to incomplete type 'struct S'
<source>:3:1: error: _Atomic cannot be applied to incomplete type 'struct S'
In the C11 standard (as well as in the C2x draft n2596.pdf) I couldn't find any constraints / semantics, which forbid / restrict applying _Atomic
to an incomplete type.
From https://github.com/llvm/llvm-project/issues/36585:
it does appear to be valid