From c9afca3d377bd32bd8dd551aee49d561cc1fa770 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 22 Aug 2016 16:54:41 +0200 Subject: Better error message for function initializer Initializers for function variables are not allowed. CompCert now reports an error and exits. Bug 19606 --- cparser/Elab.ml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cparser/Elab.ml') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 99370df6..76a7379c 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -1288,6 +1288,10 @@ and elab_single zi a il = (* Start with top-level object initialized to default *) in +if is_function_type env ty_root then begin + error loc "illegal initializer (only variables can be initialized)"; + raise Exit +end; if wrap incomplete_type loc env ty_root then begin error loc "variable has incomplete type %a" Cprint.typ ty_root; raise Exit -- cgit