- File:
-
- 1 edited
-
src/ResolvExpr/ConversionCost.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cpp
r90e683b r2a5345b 246 246 } 247 247 if (const ast::EnumInstType * srcAsInst = dynamic_cast< const ast::EnumInstType * >( src )) { 248 if ( srcAsInst->base && srcAsInst->base->is_c_enum()) {248 if (srcAsInst->base && !srcAsInst->base->isCfa) { 249 249 static const ast::BasicType* integer = new ast::BasicType( ast::BasicKind::UnsignedInt ); 250 250 return ast::Pass<ConversionCost>::read( integer, dst, srcIsLvalue, symtab, env, conversionCost ); … … 324 324 conversionCostFromBasicToBasic( basicType, dstAsBasic ); 325 325 } else if ( auto dstAsEnumInst = dynamic_cast< const ast::EnumInstType * >( dst ) ) { 326 if ( dstAsEnumInst->base && dstAsEnumInst->base->is_c_enum()) {326 if ( dstAsEnumInst->base && !dstAsEnumInst->base->isCfa ) { 327 327 cost = Cost::safe; 328 328 } … … 405 405 if ( auto dstInst = dynamic_cast<const ast::EnumInstType *>( dst ) ) { 406 406 cost = enumCastCost(inst, dstInst, symtab, env); 407 } else if ( inst->base->is_c_enum()) {407 } else if ( !inst->base->isCfa ) { 408 408 static ast::ptr<ast::BasicType> integer = { new ast::BasicType( ast::BasicKind::SignedInt ) }; 409 409 cost = costCalc( integer, dst, srcIsLvalue, symtab, env ); … … 455 455 } 456 456 457 void ConversionCost::postvisit( const ast::VarArgsType * ) { 457 void ConversionCost::postvisit( const ast::VarArgsType * varArgsType ) { 458 (void)varArgsType; 458 459 if ( dynamic_cast< const ast::VarArgsType * >( dst ) ) { 459 460 cost = Cost::zero; … … 461 462 } 462 463 463 void ConversionCost::postvisit( const ast::ZeroType * ) { 464 void ConversionCost::postvisit( const ast::ZeroType * zeroType ) { 465 (void)zeroType; 464 466 if ( dynamic_cast< const ast::ZeroType * >( dst ) ) { 465 467 cost = Cost::zero; … … 485 487 // assuming 0p is supposed to be used for pointers? 486 488 } else if ( auto dstAsEnumInst = dynamic_cast< const ast::EnumInstType * >( dst ) ) { 487 if ( dstAsEnumInst->base && dstAsEnumInst->base->is_c_enum()) {489 if ( dstAsEnumInst->base && !dstAsEnumInst->base->isCfa ) { 488 490 cost = Cost::safe; 489 491 } … … 491 493 } 492 494 493 void ConversionCost::postvisit( const ast::OneType * ) { 495 void ConversionCost::postvisit( const ast::OneType * oneType ) { 496 (void)oneType; 494 497 if ( dynamic_cast< const ast::OneType * >( dst ) ) { 495 498 cost = Cost::zero; … … 505 508 } 506 509 } else if ( auto dstAsEnumInst = dynamic_cast< const ast::EnumInstType * >( dst ) ) { 507 if ( dstAsEnumInst->base && dstAsEnumInst->base->is_c_enum()) {510 if ( dstAsEnumInst->base && !dstAsEnumInst->base->isCfa ) { 508 511 cost = Cost::safe; 509 512 }
Note:
See TracChangeset
for help on using the changeset viewer.