aboutsummaryrefslogtreecommitdiff
path: root/src/check_decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_decl.cpp')
-rw-r--r--src/check_decl.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index d3f82b1d3..8d375d548 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -45,6 +45,11 @@ Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String contex
}
t = default_type(t);
}
+ if (is_type_gen_proc(t)) {
+ error(e->token, "Invalid use of a generic procedure in %.*s", LIT(context_name));
+ e->type = t_invalid;
+ return NULL;
+ }
if (is_type_bit_field_value(t)) {
t = default_bit_field_value_type(t);
}
@@ -361,7 +366,12 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
if (pt->is_generic) {
if (pd->body == NULL) {
- error(e->token, "Generic procedures must have a body");
+ error(e->token, "Polymorphic procedures must have a body");
+ }
+
+ if (is_foreign) {
+ error(e->token, "A foreign procedures cannot be a polymorphic");
+ return;
}
}
@@ -387,6 +397,8 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
pt->require_results = is_require_results;
}
+
+
if (is_foreign) {
String name = e->token.string;
if (pd->link_name.len > 0) {