From 1106670d8b48ec4883f66b5c43f9e8e7757006e5 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Sun, 22 Apr 2018 10:09:05 +0200 Subject: Accept empty enum declaration after nonempty enum definition (#87) Forward declarations of enums are not allowed in C99, however it is possible to have an empty enum declaration after the enum was defined. --- cparser/Elab.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cparser') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index f203c777..d5e30d9f 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -996,7 +996,7 @@ and elab_enum only loc tag optmembers attrs env = let tag = match tag with None -> "" | Some s -> s in match optmembers with | None -> - if only then + if only && not (redef Env.lookup_enum env tag) then fatal_error loc "forward declaration of 'enum %s' is not allowed in ISO C" tag; let (tag', info) = wrap Env.lookup_enum loc env tag in (tag', env) -- cgit