Changes in src/ResolvExpr/CastCost.cc [c333ed2:eb7586e]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CastCost.cc
rc333ed2 reb7586e 54 54 cost = conversionCost( basicType, dst, srcIsLvalue, symtab, env ); 55 55 if ( Cost::unsafe < cost ) { 56 if (auto enumInst = dynamic_cast<const ast::EnumInstType *>(dst)) {57 // Always explict cast only for typed enum58 if (enumInst->base->isTyped)cost = Cost::unsafe;56 if (auto enumInst = dynamic_cast<const ast::EnumInstType *>(dst)) { 57 assert(enumInst->base->base); 58 cost = Cost::unsafe; 59 59 } 60 60 } … … 63 63 64 64 void postvisit( const ast::ZeroType * zero ) { 65 // auto ptr = dynamic_cast< const ast::PointerType * >( dst ); 66 // if ( ptr && basicType->isInteger() ) { 67 // // needed for, e.g. unsigned long => void * 68 // cost = Cost::unsafe; 69 // } else { 65 70 cost = conversionCost( zero, dst, srcIsLvalue, symtab, env ); 66 71 if ( Cost::unsafe < cost ) { 67 72 if (auto enumInst = dynamic_cast<const ast::EnumInstType *>(dst)) { 68 if (enumInst->base->isTyped) cost = Cost::unsafe; 73 assert(enumInst->base->base); 74 cost = Cost::unsafe; 69 75 } 70 76 } 77 // } 71 78 } 72 79 73 80 void postvisit( const ast::OneType * one ) { 81 // auto ptr = dynamic_cast< const ast::PointerType * >( dst ); 82 // if ( ptr && basicType->isInteger() ) { 83 // // needed for, e.g. unsigned long => void * 84 // cost = Cost::unsafe; 85 // } else { 74 86 cost = conversionCost( one, dst, srcIsLvalue, symtab, env ); 75 87 if ( Cost::unsafe < cost ) { 76 if (auto enumInst = dynamic_cast<const ast::EnumInstType *>(dst)) { 77 if (enumInst->base->isTyped) cost = Cost::unsafe; 88 if (auto enumInst = dynamic_cast<const ast::EnumInstType *>(dst)) { 89 assert(enumInst->base->base); 90 cost = Cost::unsafe; 78 91 } 79 92 } 93 // } 80 94 } 81 95
Note: See TracChangeset
for help on using the changeset viewer.