xref: /llvm-project/clang/test/Sema/memset-invalid-1.c (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 -fsyntax-only %s -verify
2 
3 typedef __SIZE_TYPE__ size_t;
4 void *memset(void*, int, size_t);
5 
6 typedef struct __incomplete *incomplete;
7 
mt_query_for_domain(const char * domain)8 void mt_query_for_domain(const char *domain)
9 {
10 	incomplete	query = 0;
11 	memset(query, 0, sizeof(query)); // expected-warning {{'memset' call operates on objects of type 'struct __incomplete' while the size is based on a different type 'incomplete'}} \
12 	// expected-note {{did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?}}
13 }
14 
15