From b5e0099f2875e820ff9a455ae4d6b4e9adc07ba0 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Sat, 1 Mar 2014 17:45:13 -0800 Subject: [PATCH] Fix support for enum literals with undefined values. --- elab_scope.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/elab_scope.cc b/elab_scope.cc index 1b78ac894..0701a09d8 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -238,7 +238,16 @@ static void elaborate_scope_enumeration(Design*des, NetScope*scope, } // The enumeration value must fit into the enumeration bits. - if ((cur_value > max_value) || + if (!cur_value.is_defined()) { + if (cur_value.len() > (unsigned long)use_enum->packed_width()) { + cerr << use_enum->get_fileline() + << ": error: Enumeration name " << cur->name + << " value=" << cur_value + << " is too wide for enumeration base type." << endl; + des->errors += 1; + } + + } else if ((cur_value > max_value) || (cur_value.has_sign() && (cur_value < min_value))) { cerr << use_enum->get_fileline() << ": error: Enumeration name " << cur->name