aboutsummaryrefslogtreecommitdiff
path: root/tests/tcctest.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-07-14 04:09:49 +0200
committerMichael Matz <matz@suse.de>2016-12-15 17:47:08 +0100
commit662338f116c3b87c78ddb113e8e63f6329fe307f (patch)
treebdf415f6a66394a6ffc7bcf252b44edb04a491f9 /tests/tcctest.c
parente034853b38907440142107eb689c5dd6c6621fca (diff)
downloadtinycc-662338f116c3b87c78ddb113e8e63f6329fe307f.tar.gz
tinycc-662338f116c3b87c78ddb113e8e63f6329fe307f.tar.bz2
Fix function to pointer conversion
This snippet is valid: void foo(void); ... foo + 42 ... the function designator is converted to pointer to function implicitely. gen_op didn't do that and bailed out.
Diffstat (limited to 'tests/tcctest.c')
-rw-r--r--tests/tcctest.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c
index 0b894aa..8aa50ab 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -1847,6 +1847,7 @@ void funcptr_test()
int dummy;
void (*func)(int);
} st1;
+ long diff;
printf("funcptr:\n");
func = &num;
@@ -1862,6 +1863,12 @@ void funcptr_test()
printf("sizeof2 = %d\n", sizeof funcptr_test);
printf("sizeof3 = %d\n", sizeof(&funcptr_test));
printf("sizeof4 = %d\n", sizeof &funcptr_test);
+ a = 0;
+ func = num + a;
+ diff = func - num;
+ func(42);
+ (func + diff)(42);
+ (num + a)(43);
}
void lloptest(long long a, long long b)