commit 8964018d89e7405c5a16d32b994738ba10d73f9e parent 423f75f011f84fbc1ae9b439e34860f1d09d583f Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Wed, 5 Aug 2015 22:36:24 +0200 Check format of enum constant Diffstat:
M | cc1/decl.c | | | 10 | ++++------ |
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/cc1/decl.c b/cc1/decl.c @@ -327,12 +327,10 @@ enumdcl(void) 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); }