diff options
Diffstat (limited to 'test/regression/funptr2.c')
-rw-r--r-- | test/regression/funptr2.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/regression/funptr2.c b/test/regression/funptr2.c new file mode 100644 index 00000000..5c31dd2d --- /dev/null +++ b/test/regression/funptr2.c @@ -0,0 +1,14 @@ +/* Comparisons of pointers to functions */ + +#include <stdio.h> + +int f(void) { return 0; } +int g(void) { return 1; } + +int main(void) { + printf ("f == f is %d\n", &f == &f); + printf ("f == g is %d\n", &f == &g); + /* The following is undefined behavior */ + printf ("f + 1 == f is %d\n", ((char *) &f) + 1 == (char *) &f); + return 0; +} |