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 @@ -1041,6 +1041,12 @@ class array_typet:public type_with_subtypet
10411041 }
10421042};
10431043
1044+ template <>
1045+ inline bool can_cast_type<array_typet>(const typet &type)
1046+ {
1047+ return type.id () == ID_array;
1048+ }
1049+
10441050/* ! \brief Cast a generic typet to an \ref array_typet
10451051 *
10461052 * This is an unchecked conversion. \a type must be known to be \ref
@@ -1053,7 +1059,7 @@ class array_typet:public type_with_subtypet
10531059*/
10541060inline const array_typet &to_array_type (const typet &type)
10551061{
1056- PRECONDITION (type. id ()==ID_array );
1062+ PRECONDITION (can_cast_type<array_typet>(type) );
10571063 return static_cast <const array_typet &>(type);
10581064}
10591065
@@ -1062,7 +1068,7 @@ inline const array_typet &to_array_type(const typet &type)
10621068*/
10631069inline array_typet &to_array_type (typet &type)
10641070{
1065- PRECONDITION (type. id ()==ID_array );
1071+ PRECONDITION (can_cast_type<array_typet>(type) );
10661072 return static_cast <array_typet &>(type);
10671073}
10681074
You can’t perform that action at this time.
0 commit comments