From 5a2b261e9efdfb0d9fbc51cec8c1f5405679f2a0 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 17 Dec 2015 17:27:35 +0100 Subject: Enum is compatible to its integer type. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The C standard specifies that an enum type should be compatible to some integer type (ISO/IEC 9899:TC3 ยง6.7.2.2p4). Fix 16692 --- cparser/Cutil.ml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cparser') diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index 1b0bf65d..1109cf79 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -310,6 +310,9 @@ let combine_types mode env t1 t2 = TUnion(comp_base s1 s2, comp_attr m a1 a2) | TEnum(s1, a1), TEnum(s2, a2) -> TEnum(comp_base s1 s2, comp_attr m a1 a2) + | TEnum(s,a1), TInt(enum_ikind,a2) + | TInt(enum_ikind,a2), TEnum (s,a1) -> + TEnum(s,comp_attr m a1 a2) | _, _ -> raise Incompat -- cgit