aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/16-inline.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/16-inline.c b/test/16-inline.c
new file mode 100644
index 0000000..983d9b2
--- /dev/null
+++ b/test/16-inline.c
@@ -0,0 +1,22 @@
+
+/* CFLAGS: -O1 */
+/* EXPECT:
+25;0
+*/
+
+static inline int sqr(int x) {return x*x;}
+static inline int foo(int);
+static inline int ind(int (*f)(int), int arg) {
+ return f(arg);
+}
+
+#include <stdio.h>
+int main() {
+ int q = ind(sqr, 5);
+ printf("%d;%d\n", q, ind(foo,-2));
+}
+
+static inline int foo(int w) {
+ return w+2;
+}
+