Skip to content

Commit 7b7d526

Browse files
committed
Also check type in can_cast_expr<refined_string_exprt>(expr)
Also check that expr.type() is a refined string type
1 parent 5d04804 commit 7b7d526

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/string_expr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ inline const refined_string_exprt &to_string_expr(const exprt &expr)
173173
template <>
174174
inline bool can_cast_expr<refined_string_exprt>(const exprt &base)
175175
{
176-
return base.id() == ID_struct && base.operands().size() == 2;
176+
return base.id() == ID_struct && base.operands().size() == 2 &&
177+
is_refined_string_type(base.type());
177178
}
178179

179180
inline void validate_expr(const refined_string_exprt &x)

0 commit comments

Comments
 (0)