Also check type in can_cast_expr<refined_string_exprt>(expr)

Also check that expr.type() is a refined string type
This commit is contained in:
Daniel Poetzl 2019-06-26 14:01:52 +01:00
parent 5d04804592
commit 7b7d526bcc
1 changed files with 2 additions and 1 deletions

View File

@ -173,7 +173,8 @@ inline const refined_string_exprt &to_string_expr(const exprt &expr)
template <>
inline bool can_cast_expr<refined_string_exprt>(const exprt &base)
{
return base.id() == ID_struct && base.operands().size() == 2;
return base.id() == ID_struct && base.operands().size() == 2 &&
is_refined_string_type(base.type());
}
inline void validate_expr(const refined_string_exprt &x)