From f01ad7d93225f4d3c9f104a7c1933af8da11bc36 Mon Sep 17 00:00:00 2001
From: "benjamin.franksen" <benjamin.franksen@helmholtz-berlin.de>
Date: Thu, 17 Oct 2013 23:19:07 +0000
Subject: [PATCH] test/compiler: added type_not_allowed.st

This tests rejection and warnings about bad applications of type operators.
---
 test/compiler/snc_test.plt        |  1 +
 test/compiler/type_not_allowed.st | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 test/compiler/type_not_allowed.st

diff --git a/test/compiler/snc_test.plt b/test/compiler/snc_test.plt
index f28c7d1a..922ec28a 100644
--- a/test/compiler/snc_test.plt
+++ b/test/compiler/snc_test.plt
@@ -25,6 +25,7 @@ my $tests = {
   syncq_no_size           => { warnings => 1, errors => 0  },
   syncq_not_assigned      => { warnings => 0, errors => 1  },
   syncq_size_out_of_range => { warnings => 0, errors => 1  },
+  type_not_allowed        => { warnings => 2, errors => 9  },
 };
 
 my @progs = sort(keys(%$tests));
diff --git a/test/compiler/type_not_allowed.st b/test/compiler/type_not_allowed.st
new file mode 100644
index 00000000..0917f3f6
--- /dev/null
+++ b/test/compiler/type_not_allowed.st
@@ -0,0 +1,27 @@
+program type_not_allowed
+
+#if 0
+now syntax errors:
+foreign *p_f;           /* error: pointer to foreign entity */
+foreign const c_f;      /* error: constant foreign entity */
+foreign a_f[1];         /* error: array of foreign entities */
+foreign f_f();          /* error: function returning foreign entity */
+#endif
+
+evflag *p_ef;           /* error: pointer to event flag */
+evflag a_ef[1];         /* error: array of event flags */
+evflag const c_ef;      /* error: constant event flag */
+evflag f_ef();          /* error: function returning event flag */
+
+int (const c_a)[1];     /* error: constant array */
+int (const c_f)();      /* warning: constant function */
+int const const cc_i;   /* warning: repeated const */
+
+void a_v[1];            /* error: array of void */
+
+int f__v_i(void, int);  /* error: void must be the only parameter */
+int f__v(void v);       /* error: void parameter should not have a name */
+
+int a_i_zero[0];        /* error: invalid array size (must be >= 1) */
+
+#include "../simple.st"
-- 
GitLab