aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-07 15:20:04 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-08-07 15:30:08 -0700
commitdae49ee3b43dd5b22ee9436c45cf7343ed6a4e6c (patch)
treed0fe1dae76b59fbc9f9b496f298f4a8d7b8c09d9 /tests
parent9734c6dcb98cb70629e50ca6083042783b873b9c (diff)
fix static linker parsing bug
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index b866cc08..b9807209 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -11041,6 +11041,24 @@ f.close()
voidfunc sidey(voidfunc f) { return f; }
''', 'hello from funcptr\n')
+ # function pointers with 'return' in the name
+ test('fp2', 'typedef void (*voidfunc)();', r'''
+ #include <stdio.h>
+ #include "header.h"
+ int sidey(voidfunc f);
+ void areturn0() { printf("hello 0\n"); }
+ void areturn1() { printf("hello 1\n"); }
+ void areturn2() { printf("hello 2\n"); }
+ int main(int argc, char **argv) {
+ voidfunc table[3] = { areturn0, areturn1, areturn2 };
+ table[sidey(NULL)]();
+ return 0;
+ }
+ ''', '''
+ #include "header.h"
+ int sidey(voidfunc f) { if (f) f(); return 1; }
+ ''', 'hello 1\n')
+
# Global initializer
test('global init', '', r'''
#include <stdio.h>