Add assertion suggested by Manuele.
authorMario de Sousa <msousa@fe.up.pt>
Sat, 07 Sep 2013 22:08:09 +0100
changeset 850 484beb3b1dcb
parent 849 1f8885ae539a
child 851 2c59c2b8fca4
Add assertion suggested by Manuele.
absyntax_utils/type_initial_value.cc
--- a/absyntax_utils/type_initial_value.cc	Fri Aug 23 15:13:11 2013 +0100
+++ b/absyntax_utils/type_initial_value.cc	Sat Sep 07 22:08:09 2013 +0100
@@ -220,6 +220,8 @@
 /* helper symbol for enumerated_specification->enumerated_spec_init */
 /* enumerated_value_list ',' enumerated_value */
 void *type_initial_value_c::visit(enumerated_value_list_c *symbol) {
+  /* stage1_2 never creates an enumerated_value_list_c with no entries. If this occurs, then something must have changed! */
+  if (symbol->n <= 0) ERROR;
  /* if no initial value explicitly given, then use the lowest value of the subrange */
   return (void *)symbol->elements[0];
 }