mirror of
https://github.com/TinyCC/tinycc.git
synced 2025-11-16 12:34:45 +00:00
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.
This commit is contained in:
@@ -1847,6 +1847,7 @@ void funcptr_test()
|
||||
int dummy;
|
||||
void (*func)(int);
|
||||
} st1;
|
||||
long diff;
|
||||
|
||||
printf("funcptr:\n");
|
||||
func = #
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user