Index: src/Common/utility.h
===================================================================
--- src/Common/utility.h	(revision 83794e1b7520ac5749fbef238dd63f1b9f4e9b36)
+++ src/Common/utility.h	(revision b1bead1a79d5d9fa8163bf1e0aa465cab6732772)
@@ -311,5 +311,5 @@
 struct group_iterate_t {
 	group_iterate_t( bool skipBoundsCheck, const T1 & v1, const T2 & v2 ) : args(v1, v2) {
-		assertf(skipBoundsCheck || v1.size() == v2.size(), "group iteration requires containers of the same size: <%u, %u>.", v1.size(), v2.size());
+		assertf(skipBoundsCheck || v1.size() == v2.size(), "group iteration requires containers of the same size: <%lu, %lu>.", v1.size(), v2.size());
 	};
 
Index: src/ResolvExpr/AlternativeFinder.cc
===================================================================
--- src/ResolvExpr/AlternativeFinder.cc	(revision 83794e1b7520ac5749fbef238dd63f1b9f4e9b36)
+++ src/ResolvExpr/AlternativeFinder.cc	(revision b1bead1a79d5d9fa8163bf1e0aa465cab6732772)
@@ -144,5 +144,12 @@
 			expr->get_result()->accept( global_renamer );
 		}
-	}
+
+		void referenceToRvalueConversion( Expression *& expr ) {
+			if ( dynamic_cast< ReferenceType * >( expr->get_result() ) ) {
+				// cast away reference from expr
+				expr = new CastExpr( expr, expr->get_result()->stripReferences()->clone() );
+			}
+		}
+	} // namespace
 
 	template< typename InputIterator, typename OutputIterator >
@@ -300,4 +307,6 @@
 				if ( function->get_isVarArgs() ) {
 					convCost.incUnsafe();
+					// convert reference-typed expressions to value-typed expressions
+					referenceToRvalueConversion( *actualExpr );
 					continue;
 				} else {
@@ -693,5 +702,5 @@
 		AltList candidates;
 		SemanticError errors;
-		for ( AltList::const_iterator func = funcFinder.alternatives.begin(); func != funcFinder.alternatives.end(); ++func ) {
+		for ( AltList::iterator func = funcFinder.alternatives.begin(); func != funcFinder.alternatives.end(); ++func ) {
 			try {
 				PRINT(
@@ -700,7 +709,7 @@
 				)
 				// check if the type is pointer to function
-				PointerType *pointer;
-				if ( ( pointer = dynamic_cast< PointerType* >( func->expr->get_result() ) ) ) {
+				if ( PointerType *pointer = dynamic_cast< PointerType* >( func->expr->get_result()->stripReferences() ) ) {
 					if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
+						referenceToRvalueConversion( func->expr );
 						for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
 							// XXX
@@ -708,12 +717,13 @@
 							makeFunctionAlternatives( *func, function, *actualAlt, std::back_inserter( candidates ) );
 						}
-					} else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( pointer->get_base() ) ) {
-						EqvClass eqvClass;
-						if ( func->env.lookup( typeInst->get_name(), eqvClass ) && eqvClass.type ) {
-							if ( FunctionType *function = dynamic_cast< FunctionType* >( eqvClass.type ) ) {
-								for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
-									makeFunctionAlternatives( *func, function, *actualAlt, std::back_inserter( candidates ) );
-								} // for
-							} // if
+					}
+				} else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( func->expr->get_result()->stripReferences() ) ) { // handle ftype (e.g. *? on function pointer)
+					referenceToRvalueConversion( func->expr );
+					EqvClass eqvClass;
+					if ( func->env.lookup( typeInst->get_name(), eqvClass ) && eqvClass.type ) {
+						if ( FunctionType *function = dynamic_cast< FunctionType* >( eqvClass.type ) ) {
+							for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
+								makeFunctionAlternatives( *func, function, *actualAlt, std::back_inserter( candidates ) );
+							} // for
 						} // if
 					} // if
@@ -734,9 +744,9 @@
 					}
 
-					for ( AltList::const_iterator funcOp = funcOpFinder.alternatives.begin(); funcOp != funcOpFinder.alternatives.end(); ++funcOp ) {
+					for ( AltList::iterator funcOp = funcOpFinder.alternatives.begin(); funcOp != funcOpFinder.alternatives.end(); ++funcOp ) {
 						// check if the type is pointer to function
-						PointerType *pointer;
-						if ( ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_result() ) ) ) {
+						if ( PointerType *pointer = dynamic_cast< PointerType* >( funcOp->expr->get_result()->stripReferences() ) ) {
 							if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
+								referenceToRvalueConversion( funcOp->expr );
 								for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
 									AltList currentAlt;
@@ -868,11 +878,11 @@
 			// that are cast directly.  The candidate is invalid if it has fewer results than there are types to cast
 			// to.
-			int discardedValues = (*i).expr->get_result()->size() - castExpr->get_result()->size();
+			int discardedValues = i->expr->get_result()->size() - castExpr->get_result()->size();
 			if ( discardedValues < 0 ) continue;
 			// xxx - may need to go into tuple types and extract relevant types and use unifyList. Note that currently, this does not
 			// allow casting a tuple to an atomic type (e.g. (int)([1, 2, 3]))
 			// unification run for side-effects
-			unify( castExpr->get_result(), (*i).expr->get_result(), i->env, needAssertions, haveAssertions, openVars, indexer );
-			Cost thisCost = castCost( (*i).expr->get_result(), castExpr->get_result(), indexer, i->env );
+			unify( castExpr->get_result(), i->expr->get_result(), i->env, needAssertions, haveAssertions, openVars, indexer );
+			Cost thisCost = castCost( i->expr->get_result(), castExpr->get_result(), indexer, i->env );
 			if ( thisCost != Cost::infinity ) {
 				// count one safe conversion for each value that is thrown away
