brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 2e03fd6 Raw
26 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3void escapefunc(int *);4void noescapefunc(__attribute__((noescape)) int *);5void (*escapefuncptr)(int *);6void (*noescapefuncptr)(__attribute__((noescape)) int *);7 8void func_ne(__attribute__((noescape)) int *, int *);9void func_en(int *, __attribute__((noescape)) int *);10 11void (*funcptr_ee)(int *, int *);12void (*funcptr_nn)(__attribute__((noescape)) int *, __attribute__((noescape)) int *);13 14void test0(int c) {15  escapefuncptr = &escapefunc;16  escapefuncptr = &noescapefunc;17  noescapefuncptr = &escapefunc; // expected-error {{incompatible function pointer types assigning to 'void (*)(__attribute__((noescape)) int *)' from 'void (*)(int *)'}}18  noescapefuncptr = &noescapefunc;19 20  escapefuncptr = c ? &escapefunc : &noescapefunc;21  noescapefuncptr = c ? &escapefunc : &noescapefunc; // expected-error {{incompatible function pointer types assigning to 'void (*)(__attribute__((noescape)) int *)' from 'void (*)(int *)'}}22 23  funcptr_ee = c ? &func_ne : &func_en;24  funcptr_nn = c ? &func_ne : &func_en; // expected-error {{incompatible function pointer types assigning to 'void (*)(__attribute__((noescape)) int *, __attribute__((noescape)) int *)' from 'void (*)(int *, int *)'}}25}26