diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-08-22 16:54:41 +0200 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2016-08-22 16:54:41 +0200 |
commit | c9afca3d377bd32bd8dd551aee49d561cc1fa770 (patch) | |
tree | 8baf40d368afff47720e33d761e96d301a145e86 | |
parent | 97ef3561168a6262833e65aba379ab9aca1a1a17 (diff) | |
download | compcert-c9afca3d377bd32bd8dd551aee49d561cc1fa770.tar.gz compcert-c9afca3d377bd32bd8dd551aee49d561cc1fa770.zip |
Better error message for function initializer
Initializers for function variables are not allowed. CompCert now
reports an error and exits.
Bug 19606
-rw-r--r-- | cparser/Elab.ml | 4 |
1 files changed, 4 insertions, 0 deletions
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 |