File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -974,6 +974,12 @@ class code_typet:public typet
974
974
}
975
975
};
976
976
977
+ template <>
978
+ inline bool can_cast_type<code_typet>(const typet &type)
979
+ {
980
+ return type.id () == ID_code;
981
+ }
982
+
977
983
/* ! \brief Cast a generic typet to a \ref code_typet
978
984
*
979
985
* This is an unchecked conversion. \a type must be known to be \ref
@@ -986,7 +992,8 @@ class code_typet:public typet
986
992
*/
987
993
inline const code_typet &to_code_type (const typet &type)
988
994
{
989
- PRECONDITION (type.id ()==ID_code);
995
+ PRECONDITION (can_cast_type<code_typet>(type));
996
+ validate_type (type);
990
997
return static_cast <const code_typet &>(type);
991
998
}
992
999
@@ -995,10 +1002,12 @@ inline const code_typet &to_code_type(const typet &type)
995
1002
*/
996
1003
inline code_typet &to_code_type (typet &type)
997
1004
{
998
- PRECONDITION (type.id ()==ID_code);
1005
+ PRECONDITION (can_cast_type<code_typet>(type));
1006
+ validate_type (type);
999
1007
return static_cast <code_typet &>(type);
1000
1008
}
1001
1009
1010
+
1002
1011
/* ! \brief arrays with given size
1003
1012
*/
1004
1013
class array_typet :public type_with_subtypet
You can’t perform that action at this time.
0 commit comments