llvm-project/clang/test/Sema/clear_cache.c
Aaron Ballman b6b0257972
Fix the signature for __builtin___clear_cache (#134376)
The signature was changed from void(char *, char *) to void(void *, void
*) to match GCC's signature for the same builtin.

Fixes #47833
2025-04-04 13:53:45 -04:00

13 lines
491 B
C

// RUN: %clang_cc1 -fsyntax-only -verify %s
// Ensure that __builtin___clear_cache has the expected signature. Clang used
// to have a signature accepting char * while GCC had a signature accepting
// void * that was documented incorrectly.
void test(void) {
int n = 0;
__builtin___clear_cache(&n, &n + 1); // Ok
__builtin___clear_cache((const void *)&n, (const void *)(&n + 1)); // expected-warning 2 {{passing 'const void *' to parameter of type 'void *' discards qualifiers}}
}