Changeset 2e9b59b for src/ResolvExpr/ConversionCost.cc
- Timestamp:
- Apr 19, 2022, 3:00:04 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 5b84a321
- Parents:
- ba897d21 (diff), bb7c77d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/ConversionCost.cc
rba897d21 r2e9b59b 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.