aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--evaluate.c4
-rw-r--r--validation/eval/undecl-no-indent.c19
2 files changed, 23 insertions, 0 deletions
diff --git a/evaluate.c b/evaluate.c
index 461c2547..3b9aec3c 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3130,6 +3130,10 @@ static struct symbol *evaluate_call(struct expression *expr)
if (ctype->type != SYM_FN) {
struct expression *arg;
+
+ if (fn->ctype == &bad_ctype)
+ return NULL;
+
expression_error(expr, "not a function %s",
show_ident(sym->ident));
/* do typechecking in arguments */
diff --git a/validation/eval/undecl-no-indent.c b/validation/eval/undecl-no-indent.c
new file mode 100644
index 00000000..4aadf3d9
--- /dev/null
+++ b/validation/eval/undecl-no-indent.c
@@ -0,0 +1,19 @@
+inline void fun(void)
+{
+ undecl();
+}
+
+void foo(void);
+void foo(void)
+{
+ fun();
+ fun();
+}
+
+/*
+ * check-name: undecl-no-indent
+ *
+ * check-error-start
+eval/undecl-no-indent.c:3:9: error: undefined identifier 'undecl'
+ * check-error-end
+ */