llvm-capstone/clang/test/C
Jun Zhang e07ead85a3
[Clang] Warn when trying to dereference void pointers in C
Previously we only have an extension that warn void pointer deferencing
in C++, but for C we did nothing.

C2x 6.5.3.2p4 says The unary * operator denotes indirection. If it points
to an object, the result is an lvalue designating the object. However, there
is no way to form an lvalue designating an object of an incomplete type as
6.3.2.1p1 says "an lvalue is an expression (with an object type other than
void)", so the behavior is undefined.

Fixes https://github.com/llvm/llvm-project/issues/53631

Signed-off-by: Jun Zhang <jun@junz.org>

Differential Revision: https://reviews.llvm.org/D134461
2022-09-24 22:18:04 +08:00
..
C2x Update the C status page for WG14 N2359 2022-09-22 13:05:49 -04:00
C11 Update the implementation status of some C11 features 2022-08-13 10:17:47 -04:00
C99 Update the status of some more C99 features 2022-08-17 08:11:56 -04:00
drs [Clang] Warn when trying to dereference void pointers in C 2022-09-24 22:18:04 +08:00