- File:
-
- 1 edited
-
src/ResolvExpr/AlternativeFinder.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r47534159 radcdd2f 792 792 } 793 793 794 void AlternativeFinder::visit( AlignofExpr *alignofExpr ) {795 if ( alignofExpr->get_isType() ) {796 alternatives.push_back( Alternative( alignofExpr->clone(), env, Cost::zero ) );797 } else {798 // find all alternatives for the argument to sizeof799 AlternativeFinder finder( indexer, env );800 finder.find( alignofExpr->get_expr() );801 // find the lowest cost alternative among the alternatives, otherwise ambiguous802 AltList winners;803 findMinCost( finder.alternatives.begin(), finder.alternatives.end(), back_inserter( winners ) );804 if ( winners.size() != 1 ) {805 throw SemanticError( "Ambiguous expression in alignof operand: ", alignofExpr->get_expr() );806 } // if807 // return the lowest cost alternative for the argument808 Alternative &choice = winners.front();809 alternatives.push_back( Alternative( new AlignofExpr( choice.expr->clone() ), choice.env, Cost::zero ) );810 } // if811 }812 813 794 void AlternativeFinder::resolveAttr( DeclarationWithType *funcDecl, FunctionType *function, Type *argType, const TypeEnvironment &env ) { 814 795 // assume no polymorphism
Note:
See TracChangeset
for help on using the changeset viewer.