- File:
-
- 1 edited
-
src/ResolvExpr/ConversionCost.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
r98278b3a r5af7306 20 20 #include <string> // for operator==, string 21 21 22 #include "Common/GC.h" // for new_static_root 22 23 #include "ResolvExpr/Cost.h" // for Cost 23 24 #include "ResolvExpr/TypeEnvironment.h" // for EqvClass, TypeEnvironment … … 275 276 // xxx - not positive this is correct, but appears to allow casting int => enum 276 277 cost = Cost::unsafe; 277 } // if 278 // no cases for zero_t/one_t because it should not be possible to convert int, etc. to zero_t/one_t. 278 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) { 279 cost = Cost::unsafe; 280 } // if 279 281 } 280 282 … … 308 310 // assignResult == 0 means Cost::Infinity 309 311 } // if 310 // case case for zero_t because it should not be possible to convert pointers to zero_t. 312 } else if ( dynamic_cast< ZeroType * >( dest ) ) { 313 cost = Cost::unsafe; 311 314 } // if 312 315 } … … 351 354 void ConversionCost::postvisit( EnumInstType * ) { 352 355 static Type::Qualifiers q; 353 static BasicType integer( q, BasicType::SignedInt );354 cost = costFunc( &integer, dest, indexer, env ); // safe if dest >= int356 static BasicType* integer = new_static_root<BasicType>( q, BasicType::SignedInt ); 357 cost = costFunc( integer, dest, indexer, env ); // safe if dest >= int 355 358 if ( cost < Cost::unsafe ) { 356 359 cost.incSafe();
Note:
See TracChangeset
for help on using the changeset viewer.