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