ref: 8964018d89e7405c5a16d32b994738ba10d73f9e
parent: 423f75f011f84fbc1ae9b439e34860f1d09d583f
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Aug 5 18:36:24 EDT 2015
Check format of enum constant
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -327,12 +327,10 @@
sym->flags |= ISCONSTANT;
sym->type = inttype;
if (accept('=')) {
- Node *np = constexpr();
- /*
- * TODO: check that the type of the constant
- * expression is the correct, that in this
- * case should be int
- */
+ Node *np = iconstexpr();
+
+ if (np == NULL)
+ error("invalid enumeration value");
val = np->sym->u.i;
freetree(np);
}