cast enum expressions to enum type if needed
authorMatthias Braun <matze@braunis.de>
Thu, 14 Feb 2008 15:44:59 +0000 (15:44 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 14 Feb 2008 15:44:59 +0000 (15:44 +0000)
[r18858]

parser.c

index bb29247..b85ac28 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1570,7 +1570,10 @@ static void parse_enum_entries(type_t *const enum_type)
 
                if(token.type == '=') {
                        next_token();
-                       entry->init.enum_value = parse_constant_expression();
+                       expression_t *value = parse_constant_expression();
+
+                       value = create_implicit_cast(value, enum_type);
+                       entry->init.enum_value = value;
 
                        /* TODO semantic */
                }