File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1032,6 +1032,12 @@ class array_typet:public type_with_subtypet
10321032 }
10331033};
10341034
1035+ template <>
1036+ inline bool can_cast_type<array_typet>(const typet &type)
1037+ {
1038+ return type.id () == ID_array;
1039+ }
1040+
10351041/* ! \brief Cast a generic typet to an \ref array_typet
10361042 *
10371043 * This is an unchecked conversion. \a type must be known to be \ref
@@ -1044,7 +1050,7 @@ class array_typet:public type_with_subtypet
10441050*/
10451051inline const array_typet &to_array_type (const typet &type)
10461052{
1047- PRECONDITION (type. id ()==ID_array );
1053+ PRECONDITION (can_cast_type<array_typet>(type) );
10481054 return static_cast <const array_typet &>(type);
10491055}
10501056
@@ -1053,7 +1059,7 @@ inline const array_typet &to_array_type(const typet &type)
10531059*/
10541060inline array_typet &to_array_type (typet &type)
10551061{
1056- PRECONDITION (type. id ()==ID_array );
1062+ PRECONDITION (can_cast_type<array_typet>(type) );
10571063 return static_cast <array_typet &>(type);
10581064}
10591065
You can’t perform that action at this time.
0 commit comments