[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
Loading
Please sign in to comment