Changeset f238fcc2 for src/ResolvExpr
- Timestamp:
- Mar 21, 2022, 3:17:37 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 4390fb6
- Parents:
- 3e54399
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
r3e54399 rf238fcc2 333 333 } else if ( dynamic_cast< const EnumInstType * >( dest ) ) { 334 334 // xxx - not positive this is correct, but appears to allow casting int => enum 335 cost = Cost::unsafe; 335 // TODO 336 EnumDecl * decl = dynamic_cast< const EnumInstType * >( dest )->baseEnum; 337 if ( decl->base ) { 338 cost = Cost::infinity; 339 } else { 340 cost = Cost::unsafe; 341 } // if 336 342 } // if 337 343 // no cases for zero_t/one_t because it should not be possible to convert int, etc. to zero_t/one_t. … … 610 616 } else if ( dynamic_cast< const ast::EnumInstType * >( dst ) ) { 611 617 // xxx - not positive this is correct, but appears to allow casting int => enum 612 cost = Cost::unsafe; 618 const ast::EnumDecl * decl = (dynamic_cast< const ast::EnumInstType * >( dst ))->base.get(); 619 if ( decl->base ) { 620 cost = Cost::infinity; 621 } else { 622 cost = Cost::unsafe; 623 } // if 613 624 } 614 625 }
Note: See TracChangeset
for help on using the changeset viewer.