File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1131,14 +1131,17 @@ verilog_typecheck_exprt::convert_integer_constant_expression(exprt expr)
1131
1131
{
1132
1132
convert_expr (expr);
1133
1133
1134
+ // copy the source location, we will modify 'expr'
1135
+ auto source_location = expr.source_location ();
1136
+
1134
1137
// this could be large
1135
1138
propagate_type (expr, integer_typet ());
1136
1139
1137
1140
exprt tmp = elaborate_constant_expression (expr);
1138
1141
1139
1142
if (!tmp.is_constant ())
1140
1143
{
1141
- throw errort ().with_location (expr. source_location () )
1144
+ throw errort ().with_location (source_location)
1142
1145
<< " expected constant expression, but got `" << to_string (tmp) << ' \' ' ;
1143
1146
}
1144
1147
@@ -1153,7 +1156,7 @@ verilog_typecheck_exprt::convert_integer_constant_expression(exprt expr)
1153
1156
auto value_opt = numeric_cast<mp_integer>(tmp_constant);
1154
1157
if (!value_opt.has_value ())
1155
1158
{
1156
- throw errort ().with_location (expr. source_location () )
1159
+ throw errort ().with_location (source_location)
1157
1160
<< " failed to convert `" << to_string (tmp_constant)
1158
1161
<< " \' into an integer constant" ;
1159
1162
}
You can’t perform that action at this time.
0 commit comments