1 | // RUN: %clang -g -fsanitize=function %s -o %t |
---|---|
2 | // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --implicit-check-not='runtime error:' |
3 | |
4 | void f(void (*fp)(int (*)[])) { fp(0); } |
5 | |
6 | void callee0(int (*a)[]) {} |
7 | void callee1(int (*a)[1]) {} |
8 | |
9 | int main() { |
10 | int a[1]; |
11 | f(fp: callee0); |
12 | // CHECK: runtime error: call to function callee1 through pointer to incorrect function type 'void (*)(int (*)[])' |
13 | f(fp: callee1); // compatible type in C, but flagged |
14 | } |
15 |