[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Sema / noescape.c
blob2e03fd6d25d2e231566528bc616693a5831e9358
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 void escapefunc(int *);
4 void noescapefunc(__attribute__((noescape)) int *);
5 void (*escapefuncptr)(int *);
6 void (*noescapefuncptr)(__attribute__((noescape)) int *);
8 void func_ne(__attribute__((noescape)) int *, int *);
9 void func_en(int *, __attribute__((noescape)) int *);
11 void (*funcptr_ee)(int *, int *);
12 void (*funcptr_nn)(__attribute__((noescape)) int *, __attribute__((noescape)) int *);
14 void 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;
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 *)'}}
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 *)'}}