Changeset 74cdfb1 for src/ResolvExpr
- Timestamp:
- Dec 14, 2017, 10:52:51 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 9058414
- Parents:
- 6e027d6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/CommonType.cc
r6e027d6 r74cdfb1 91 91 // special case where one type has a reference depth of 1 larger than the other 92 92 if ( diff > 0 || diff < 0 ) { 93 // std::cerr << "reference depth diff: " << diff << std::endl; 93 94 Type * result = nullptr; 94 if ( ReferenceType * ref1 = dynamic_cast< ReferenceType * >( type1 ) ) { 95 ReferenceType * ref1 = dynamic_cast< ReferenceType * >( type1 ); 96 ReferenceType * ref2 = dynamic_cast< ReferenceType * >( type2 ); 97 if ( diff > 0 ) { 98 // deeper on the left 99 assert( ref1 ); 100 result = handleReference( ref1->base, type2, widenFirst, widenSecond, indexer, env, openVars ); 101 } else { 102 // deeper on the right 103 assert( ref2 ); 104 result = handleReference( type1, ref2->base, widenFirst, widenSecond, indexer, env, openVars ); 105 } 106 if ( result && ref1 ) { 95 107 // formal is reference, so result should be reference 96 result = handleReference( ref1->base, type2, widenFirst, widenSecond, indexer, env, openVars ); 97 if ( result ) result = new ReferenceType( ref1->get_qualifiers(), result ); 98 } else { 99 // formal is value, so result should be value 100 ReferenceType * ref2 = strict_dynamic_cast< ReferenceType * > ( type2 ); 101 result = handleReference( type1, ref2->base, widenFirst, widenSecond, indexer, env, openVars ); 108 // std::cerr << "formal is reference; result should be reference" << std::endl; 109 result = new ReferenceType( ref1->get_qualifiers(), result ); 102 110 } 103 111 // std::cerr << "common type of reference [" << type1 << "] and [" << type2 << "] is [" << result << "]" << std::endl;
Note: See TracChangeset
for help on using the changeset viewer.