File tree 1 file changed +8
-2
lines changed
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
1041
1041
}
1042
1042
};
1043
1043
1044
+ template <>
1045
+ inline bool can_cast_type<array_typet>(const typet &type)
1046
+ {
1047
+ return type.id () == ID_array;
1048
+ }
1049
+
1044
1050
/* ! \brief Cast a generic typet to an \ref array_typet
1045
1051
*
1046
1052
* This is an unchecked conversion. \a type must be known to be \ref
@@ -1053,7 +1059,7 @@ class array_typet:public type_with_subtypet
1053
1059
*/
1054
1060
inline const array_typet &to_array_type (const typet &type)
1055
1061
{
1056
- PRECONDITION (type. id ()==ID_array );
1062
+ PRECONDITION (can_cast_type<array_typet>(type) );
1057
1063
return static_cast <const array_typet &>(type);
1058
1064
}
1059
1065
@@ -1062,7 +1068,7 @@ inline const array_typet &to_array_type(const typet &type)
1062
1068
*/
1063
1069
inline array_typet &to_array_type (typet &type)
1064
1070
{
1065
- PRECONDITION (type. id ()==ID_array );
1071
+ PRECONDITION (can_cast_type<array_typet>(type) );
1066
1072
return static_cast <array_typet &>(type);
1067
1073
}
1068
1074
You can’t perform that action at this time.
0 commit comments