Pekka Jaaskelainen | 8690a68 | 2014-02-20 13:52:08 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only |
| 2 | |
| 3 | void foo(void*); |
| 4 | |
| 5 | void bar() |
| 6 | { |
| 7 | // declaring a function pointer is an error |
| 8 | void (*fptr)(int); // expected-error{{pointers to functions are not allowed}} |
| 9 | |
| 10 | // taking the address of a function is an error |
| 11 | foo((void*)foo); // expected-error{{taking address of function is not allowed}} |
| 12 | foo(&foo); // expected-error{{taking address of function is not allowed}} |
| 13 | |
| 14 | // just calling a function is correct |
| 15 | foo(0); |
| 16 | } |