Ignore:
Timestamp:
Jun 26, 2015, 1:43:41 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, 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, resolv-new, string, with_gc
Children:
937e51d
Parents:
0f19d763
Message:

Fixed pointer to pointer to const bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Unify.cc

    r0f19d763 reb50842  
    7373        };
    7474
     75        /// Attempts an inexact unification of type1 and type2.
     76        /// Returns false if no such unification; if the types can be unified, sets common (unless they unify exactly and have identical type qualifiers)
    7577        bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer, Type *&common );
    7678        bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer );
     
    148150                        if ( curClass.type ) {
    149151                                Type *common = 0;
     152                                // attempt to unify equivalence class type (which has qualifiers stripped, so they must be restored) with the type to bind to
    150153                                std::auto_ptr< Type > newType( curClass.type->clone() );
     154                                newType->get_qualifiers() = typeInst->get_qualifiers();
    151155                                if ( unifyInexact( newType.get(), other, env, needAssertions, haveAssertions, openVars, widenMode & WidenMode( curClass.allowWidening, true ), indexer, common ) ) {
    152156                                        if ( common ) {
     
    279283                TypeEnvironment debugEnv( env );
    280284#endif
     285                if ( type1->get_qualifiers() != type2->get_qualifiers() ) {
     286                        return false;
     287                }
     288
    281289                bool result;
    282290                TypeInstType *var1 = dynamic_cast< TypeInstType* >( type1 );
     
    291299                bool isopen1 = var1 && ( entry1 != openVars.end() );
    292300                bool isopen2 = var2 && ( entry2 != openVars.end() );
    293                 if ( type1->get_qualifiers() != type2->get_qualifiers() ) {
    294                         return false;
    295                 } else if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
     301
     302                if ( isopen1 && isopen2 && entry1->second == entry2->second ) {
    296303                        result = bindVarToVar( var1, var2, entry1->second, env, needAssertions, haveAssertions, openVars, widenMode, indexer );
    297304                } else if ( isopen1 ) {
Note: See TracChangeset for help on using the changeset viewer.