From c51f48cc760389a67a729b7b977502eb21c33e50 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 14 Jul 2015 15:38:15 +0200 Subject: Reject incomplete types as return type. --- cparser/Elab.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cparser') 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 -- cgit