scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit b4f515b94287dcac47fb6fb923700ad066afa523
parent 99bbacfea1e1440120f0bc7579a36c09f16e342a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 26 Oct 2022 15:22:20 +0200

test/cc: Add execute/0212-krtypes.c

Diffstat:
Atests/cc/execute/0212-krtypes.c | 36++++++++++++++++++++++++++++++++++++
Mtests/cc/execute/scc-tests.lst | 1+
2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/tests/cc/execute/0212-krtypes.c b/tests/cc/execute/0212-krtypes.c @@ -0,0 +1,36 @@ +int +f1(int a) +{ + return a-1; +} + +int +f2(double a) +{ + return 0; +} + +int +f3(int (*p)(), int a) +{ + return (*p)(a); +} + +int +main() +{ + int (*fp1)(); + int (*fp2)(int (*)(int), int); + + fp1 = f1; + if ((*fp1)(1) != 0) + return 1; + fp1 = f2; + if ((*fp1)(0) != 0) + return 2; + fp2 = f3; + if ((fp2)(f1, 1) != 0) + return 3; + + return 0; +} diff --git a/tests/cc/execute/scc-tests.lst b/tests/cc/execute/scc-tests.lst @@ -202,3 +202,4 @@ 0209-dowhile.c 0210-flexible.c 0211-enum.c +0212-krtypes.c