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
1032
1032
}
1033
1033
};
1034
1034
1035
+ template <>
1036
+ inline bool can_cast_type<array_typet>(const typet &type)
1037
+ {
1038
+ return type.id () == ID_array;
1039
+ }
1040
+
1035
1041
/* ! \brief Cast a generic typet to an \ref array_typet
1036
1042
*
1037
1043
* This is an unchecked conversion. \a type must be known to be \ref
@@ -1044,7 +1050,7 @@ class array_typet:public type_with_subtypet
1044
1050
*/
1045
1051
inline const array_typet &to_array_type (const typet &type)
1046
1052
{
1047
- PRECONDITION (type. id ()==ID_array );
1053
+ PRECONDITION (can_cast_type<array_typet>(type) );
1048
1054
return static_cast <const array_typet &>(type);
1049
1055
}
1050
1056
@@ -1053,7 +1059,7 @@ inline const array_typet &to_array_type(const typet &type)
1053
1059
*/
1054
1060
inline array_typet &to_array_type (typet &type)
1055
1061
{
1056
- PRECONDITION (type. id ()==ID_array );
1062
+ PRECONDITION (can_cast_type<array_typet>(type) );
1057
1063
return static_cast <array_typet &>(type);
1058
1064
}
1059
1065
You can’t perform that action at this time.
0 commit comments