Changeset 9fd97126 for src


Ignore:
Timestamp:
Apr 15, 2016, 1:45:07 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
347c42f
Parents:
baba5d8
Message:

Fix casts between pointer and integer types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CastCost.cc

    rbaba5d8 r9fd97126  
    6969                PointerType *destAsPointer = dynamic_cast< PointerType* >( dest );
    7070                if ( destAsPointer && basicType->isInteger() ) {
    71                         //cost = Cost( 1, 0, 0 );
    72                         cost = Cost::infinity;
     71                        // necessary for, e.g. unsigned long => void*
     72                        cost = Cost( 1, 0, 0 );
    7373                } else {
    7474                        ConversionCost::visit( basicType );
     
    8989                                } else if ( castResult < 0 ) {
    9090                                        cost = Cost::infinity;
    91                                         //cost = Cost( 1, 0, 0 );
    9291                                } // if
    9392                        } // if
    9493                } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {
    9594                        if ( destAsBasic->isInteger() ) {
    96                                 //cost = Cost( 1, 0, 0 );
    97                                 cost = Cost::infinity;
     95                                // necessary for, e.g. void* => unsigned long
     96                                cost = Cost( 1, 0, 0 );
    9897                        } // if
    9998                }
Note: See TracChangeset for help on using the changeset viewer.