24 lines · c
1// RUN: %clang_cc1 -verify -std=c2y %s2// RUN: %clang_cc1 -verify -std=c23 %s3 4/* WG14 N3481: Yes5 * Slay Some Earthly Demons XVI6 *7 * It was previously UB to use a non-array lvalue with an incomplete type in a8 * context which required the value of the object. Clang has always diagnosed9 * this as an error, except when the incomplete type is void. Then we allow the10 * dereference, but not for a value computation.11 */12 13struct f *p; // expected-note {{forward declaration of 'struct f'}}14void g(void) {15 (void)*p; // expected-error {{incomplete type 'struct f' where a complete type is required}}16}17 18void h(void *ptr) {19 (void)*ptr; // expected-warning {{ISO C does not allow indirection on operand of type 'void *'}}20 (*ptr)++; /* expected-warning {{ISO C does not allow indirection on operand of type 'void *'}}21 expected-error {{cannot increment value of type 'void'}}22 */23}24