@@ -2847,12 +2847,9 @@ exprt c_typecheck_baset::do_special_functions(
2847
2847
if (expr.arguments ().size () != 1 )
2848
2848
{
2849
2849
error ().source_location = expr.source_location ();
2850
- error () << " __enum_is_in_range expects one argument" << eom;
2851
- std::ostringstream error_message;
2852
- error_message << expr.source_location ().as_string () << " : "
2853
- << " __enum_is_in_range expects one argument, "
2854
- << expr.arguments ().size () << " were provided" ;
2855
- throw invalid_source_file_exceptiont{error_message.str ()};
2850
+ error () << identifier << " expects one argument, " <<
2851
+ expr.arguments ().size () << " were provided" << eom;
2852
+ throw 0 ;
2856
2853
}
2857
2854
// Replace expr with giant boolean that checks all the values
2858
2855
// of the enumeration as disjunction
@@ -2863,8 +2860,7 @@ exprt c_typecheck_baset::do_special_functions(
2863
2860
auto c_enum_tag_type =
2864
2861
type_try_dynamic_cast<c_enum_tag_typet>(arg1.type ()))
2865
2862
{
2866
- symbolt enum_type = this ->lookup (c_enum_tag_type->get_identifier ());
2867
- const c_enum_typet &c_enum_type = to_c_enum_type (enum_type.type );
2863
+ const c_enum_typet &c_enum_type = follow_tag (*c_enum_tag_type);
2868
2864
const c_enum_typet::memberst enum_values = c_enum_type.members ();
2869
2865
2870
2866
std::vector<exprt> disjuncts;
@@ -2879,10 +2875,9 @@ exprt c_typecheck_baset::do_special_functions(
2879
2875
else
2880
2876
{
2881
2877
// Can't enum range check a non-enum
2882
- std::ostringstream error_message;
2883
- error_message << expr.source_location ().as_string () << " : "
2884
- << " __enum_is_in_range expects enum argument type" ;
2885
- throw invalid_source_file_exceptiont{error_message.str ()};
2878
+ error ().source_location = expr.source_location ();
2879
+ error () << identifier << " expects enum argument type" << eom;
2880
+ throw 0 ;
2886
2881
}
2887
2882
}
2888
2883
else if (
0 commit comments