File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 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
974974 }
975975};
976976
977+ template <>
978+ inline bool can_cast_type<code_typet>(const typet &type)
979+ {
980+ return type.id () == ID_code;
981+ }
982+
977983/* ! \brief Cast a generic typet to a \ref code_typet
978984 *
979985 * This is an unchecked conversion. \a type must be known to be \ref
@@ -986,7 +992,8 @@ class code_typet:public typet
986992*/
987993inline const code_typet &to_code_type (const typet &type)
988994{
989- PRECONDITION (type.id ()==ID_code);
995+ PRECONDITION (can_cast_type<code_typet>(type));
996+ validate_type (type);
990997 return static_cast <const code_typet &>(type);
991998}
992999
@@ -995,10 +1002,12 @@ inline const code_typet &to_code_type(const typet &type)
9951002*/
9961003inline code_typet &to_code_type (typet &type)
9971004{
998- PRECONDITION (type.id ()==ID_code);
1005+ PRECONDITION (can_cast_type<code_typet>(type));
1006+ validate_type (type);
9991007 return static_cast <code_typet &>(type);
10001008}
10011009
1010+
10021011/* ! \brief arrays with given size
10031012*/
10041013class array_typet :public type_with_subtypet
You can’t perform that action at this time.
0 commit comments