aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Elab.ml
diff options
context:
space:
mode:
Diffstat (limited to 'cparser/Elab.ml')
-rw-r--r--cparser/Elab.ml5
1 files changed, 4 insertions, 1 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index 9ff7823f..de24871f 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -1884,7 +1884,10 @@ let elab_fundef env spec name body loc =
(* Extract info from type *)
let (ty_ret, params, vararg, attr) =
match ty with
- | TFun(ty_ret, Some params, vararg, attr) -> (ty_ret, params, vararg, attr)
+ | TFun(ty_ret, Some params, vararg, attr) ->
+ if wrap incomplete_type loc env1 ty_ret && not (is_void_type env ty_ret) then
+ fatal_error loc "return type is an incomplete type";
+ (ty_ret, params, vararg, attr)
| _ -> fatal_error loc "wrong type for function definition" in
(* Enter function in the environment, for recursive references *)
let (fun_id, sto1, env1,ty) = enter_or_refine_ident false loc env1 s sto ty in