[PATCH] D134461: [Clang] Diagnose an error when trying to deferencing void pointers in C
Jun Zhang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 22 11:05:40 PDT 2022
junaire added a comment.
I'd admit that passing a boolean between these functions is ugly but surprisingly it works! even for `&(void_ptr)! But yeah, please suggest if you have better solutions ;D
================
Comment at: clang/test/C/drs/dr1xx.c:142
/* The behavior of all three of these is undefined. */
- (void)*p;
- (void)(i ? *p : *p);
+ (void)*p; /* expected-warning {{deference a void pointer has undefined behavior}} */
+ (void)(i ? *p : *p); /* expected-warning {{deference a void pointer has undefined behavior}} */
----------------
I seem not dealing with the tests correctly, mostly because we're specifying multiple run lines with different standards. Can you help me a little bit with this? @aaron.ballman
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134461/new/
https://reviews.llvm.org/D134461
More information about the cfe-commits
mailing list