Index: src/ResolvExpr/AlternativeFinder.h
===================================================================
--- src/ResolvExpr/AlternativeFinder.h	(revision e472d54add7ff0b5a6cccd337055f238354337a6)
+++ src/ResolvExpr/AlternativeFinder.h	(revision a8b27c63155718a34534b0647bd76f979bc66cdf)
@@ -21,4 +21,5 @@
 
 #include "Alternative.h"                 // for AltList, Alternative
+#include "ExplodedActual.h"              // for ExplodedActual
 #include "ResolvExpr/Cost.h"             // for Cost, Cost::infinity
 #include "ResolvExpr/TypeEnvironment.h"  // for AssertionSet, OpenVarSet
@@ -31,4 +32,10 @@
 
 namespace ResolvExpr {
+	class ArgPack;
+	
+	/// First index is which argument, second index is which alternative for that argument, 
+	/// third index is which exploded element of that alternative
+	using ExplodedArgs = std::vector< std::vector< ExplodedActual > >;
+	
 	class AlternativeFinder : public Visitor {
 	  public:
@@ -61,7 +68,11 @@
 		}
 
-		void find( Expression *expr, bool adjust = false, bool prune = true );
+		void find( Expression *expr, bool adjust = false, bool prune = true, bool failFast = true );
 		/// Calls find with the adjust flag set; adjustment turns array and function types into equivalent pointer types
-		void findWithAdjustment( Expression *expr, bool prune = true );
+		void findWithAdjustment( Expression *expr );
+		/// Calls find with the adjust flag set and prune flag unset; pruning ensures there is at most one alternative per result type
+		void findWithoutPrune( Expression *expr );
+		/// Calls find with the adjust and prune flags set, failFast flags unset; fail fast ensures that there is at least one resulting alternative
+		void maybeFind( Expression *expr );
 		AltList &get_alternatives() { return alternatives; }
 
@@ -77,4 +88,9 @@
 		const SymTab::Indexer &get_indexer() const { return indexer; }
 		const TypeEnvironment &get_environ() const { return env; }
+
+		/// Runs a new alternative finder on each element in [begin, end)
+		/// and writes each alternative finder to out.
+		template< typename InputIterator, typename OutputIterator >
+		void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
 	  private:
 		virtual void visit( ApplicationExpr *applicationExpr );
@@ -108,8 +124,4 @@
 		virtual void visit( StmtExpr *stmtExpr );
 		virtual void visit( UntypedInitExpr *initExpr );
-		/// Runs a new alternative finder on each element in [begin, end)
-		/// and writes each alternative finder to out.
-		template< typename InputIterator, typename OutputIterator >
-		void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
 
 		/// Adds alternatives for anonymous members
@@ -121,6 +133,11 @@
 		/// Adds alternatives for offsetof expressions, given the base type and name of the member
 		template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
+		/// Takes a final result and checks if its assertions can be satisfied
 		template<typename OutputIterator>
-		void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const std::vector< AlternativeFinder >& args, OutputIterator out );
+		void validateFunctionAlternative( const Alternative &func, ArgPack& result, const std::vector<ArgPack>& results, OutputIterator out );
+		/// Finds matching alternatives for a function, given a set of arguments
+		template<typename OutputIterator>
+		void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const ExplodedArgs& args, OutputIterator out );
+		/// Checks if assertion parameters match for a new alternative
 		template< typename OutputIterator >
 		void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
@@ -134,4 +151,5 @@
 
 	Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
+	void referenceToRvalueConversion( Expression *& expr );
 
 	template< typename InputIterator, typename OutputIterator >
