Changes in src/ResolvExpr/Unify.cc [1dcd52a3:36a2367]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Unify.cc
r1dcd52a3 r36a2367 563 563 flatten( dcl->get_type(), back_inserter( types ) ); 564 564 for ( Type * t : types ) { 565 // outermost const, volatile, _Atomic qualifiers in parameters should not play a role in the unification of function types, since they do not determine whether a function is callable.566 // Note: MUST consider at least mutex qualifier, since functions can be overloaded on outermost mutex and a mutex function has different requirements than a non-mutex function.567 t->get_qualifiers() -= Type::Qualifiers(Type::Const | Type::Volatile | Type::Atomic);568 569 565 dst.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::C, nullptr, t, nullptr ) ); 570 566 } … … 584 580 585 581 // sizes don't have to match if ttypes are involved; need to be more precise wrt where the ttype is to prevent errors 586 if ( (flatFunc-> parameters.size() == flatOther->parameters.size() && flatFunc->returnVals.size() == flatOther->returnVals.size()) || flatFunc->isTtype() || flatOther->isTtype() ) {587 if ( unifyDeclList( flatFunc-> parameters.begin(), flatFunc->parameters.end(), flatOther->parameters.begin(), flatOther->parameters.end(), env, needAssertions, haveAssertions, openVars, indexer ) ) {588 if ( unifyDeclList( flatFunc-> returnVals.begin(), flatFunc->returnVals.end(), flatOther->returnVals.begin(), flatOther->returnVals.end(), env, needAssertions, haveAssertions, openVars, indexer ) ) {582 if ( (flatFunc->get_parameters().size() == flatOther->get_parameters().size() && flatFunc->get_returnVals().size() == flatOther->get_returnVals().size()) || flatFunc->isTtype() || flatOther->isTtype() ) { 583 if ( unifyDeclList( flatFunc->get_parameters().begin(), flatFunc->get_parameters().end(), flatOther->get_parameters().begin(), flatOther->get_parameters().end(), env, needAssertions, haveAssertions, openVars, indexer ) ) { 584 if ( unifyDeclList( flatFunc->get_returnVals().begin(), flatFunc->get_returnVals().end(), flatOther->get_returnVals().begin(), flatOther->get_returnVals().end(), env, needAssertions, haveAssertions, openVars, indexer ) ) { 589 585 590 586 // the original types must be used in mark assertions, since pointer comparisons are used … … 603 599 // check that other type is compatible and named the same 604 600 RefType *otherStruct = dynamic_cast< RefType* >( other ); 605 result = otherStruct && inst-> name == otherStruct->name;601 result = otherStruct && inst->get_name() == otherStruct->get_name(); 606 602 } 607 603 … … 612 608 if ( ! result ) return; 613 609 // Check that parameters of types unify, if any 614 std::list< Expression* > params = inst-> parameters;615 std::list< Expression* > otherParams = ((RefType*)other)-> parameters;610 std::list< Expression* > params = inst->get_parameters(); 611 std::list< Expression* > otherParams = ((RefType*)other)->get_parameters(); 616 612 617 613 std::list< Expression* >::const_iterator it = params.begin(), jt = otherParams.begin();
Note:
See TracChangeset
for help on using the changeset viewer.