Index: src/ResolvExpr/ConversionCost.cc
===================================================================
--- src/ResolvExpr/ConversionCost.cc	(revision 89be1c68ce6af5c822ac429caef167ce24a3cf97)
+++ src/ResolvExpr/ConversionCost.cc	(revision 7ebaa561f92e838ec05df234d5162f761db9e87f)
@@ -21,9 +21,10 @@
 
 namespace ResolvExpr {
-	const Cost Cost::zero = Cost( 0, 0, 0 );
-	const Cost Cost::infinity = Cost( -1, -1, -1 );
-	const Cost Cost::unsafe = Cost( 1, 0, 0 );
-	const Cost Cost::poly = Cost( 0, 1, 0 );
-	const Cost Cost::safe = Cost( 0, 0, 1 );
+	const Cost Cost::zero = Cost( 0, 0, 0, 0 );
+	const Cost Cost::infinity = Cost( -1, -1, -1, -1 );
+	const Cost Cost::unsafe = Cost( 1, 0, 0, 0 );
+	const Cost Cost::poly = Cost( 0, 1, 0, 0 );
+	const Cost Cost::safe = Cost( 0, 0, 1, 0 );
+	const Cost Cost::reference = Cost( 0, 0, 0, 1 );
 
 
@@ -80,12 +81,10 @@
 			// TODO: document this
 			Cost cost = convertToReferenceCost( safe_dynamic_cast< ReferenceType * >( src )->get_base(), dest, diff-1, indexer, env );
-			// TODO: increment reference cost
-			cost.incSafe();
+			cost.incReference();
 			return cost;
 		} else if ( diff < -1 ) {
 			// TODO: document this
 			Cost cost = convertToReferenceCost( src, safe_dynamic_cast< ReferenceType * >( dest )->get_base(), diff+1, indexer, env );
-			// TODO: increment reference cost
-			cost.incSafe();
+			cost.incReference();
 			return cost;
 		} else if ( diff == 0 ) {
@@ -119,7 +118,7 @@
 					// lvalue-to-reference conversion:  cv lvalue T => cv T &
 					if ( src->get_qualifiers() == destAsRef->get_base()->get_qualifiers() ) {
-						return Cost::safe; // cost needs to be non-zero to add cast
+						return Cost::reference; // cost needs to be non-zero to add cast
 					} if ( src->get_qualifiers() < destAsRef->get_base()->get_qualifiers() ) {
-						return Cost::safe + Cost::safe; // cost needs to be higher than previous cast to differentiate adding qualifiers vs. keeping same
+						return Cost::safe; // cost needs to be higher than previous cast to differentiate adding qualifiers vs. keeping same
 					} else {
 						return Cost::unsafe;
@@ -273,6 +272,5 @@
 		// cv can be safely dropped because of 'implicit dereference' behavior.
 		refType->get_base()->accept( *this );
-		// TODO: increment reference cost
-		cost.incSafe();
+		cost.incReference();
 	}
 
Index: src/ResolvExpr/Cost.h
===================================================================
--- src/ResolvExpr/Cost.h	(revision 89be1c68ce6af5c822ac429caef167ce24a3cf97)
+++ src/ResolvExpr/Cost.h	(revision 7ebaa561f92e838ec05df234d5162f761db9e87f)
@@ -22,5 +22,5 @@
 	class Cost {
 	  private:
-		Cost( int unsafeCost, int polyCost, int safeCost );
+		Cost( int unsafeCost, int polyCost, int safeCost, int referenceCost );
 
 	  public:
@@ -28,4 +28,5 @@
 		Cost & incPoly( int inc = 1 );
 		Cost & incSafe( int inc = 1 );
+		Cost & incReference( int inc = 1 );
 
 		Cost operator+( const Cost &other ) const;
@@ -39,7 +40,9 @@
 		static const Cost zero;
 		static const Cost infinity;
+
 		static const Cost unsafe;
 		static const Cost poly;
 		static const Cost safe;
+		static const Cost reference;
 	  private:
 		int compare( const Cost &other ) const;
@@ -48,7 +51,8 @@
 		int polyCost;
 		int safeCost;
+		int referenceCost;
 	};
 
-	inline Cost::Cost( int unsafeCost, int polyCost, int safeCost ) : unsafeCost( unsafeCost ), polyCost( polyCost ), safeCost( safeCost ) {}
+	inline Cost::Cost( int unsafeCost, int polyCost, int safeCost, int referenceCost ) : unsafeCost( unsafeCost ), polyCost( polyCost ), safeCost( safeCost ), referenceCost( referenceCost ) {}
 
 	inline Cost & Cost::incUnsafe( int inc ) {
@@ -67,10 +71,15 @@
 	}
 
+	inline Cost & Cost::incReference( int inc ) {
+		referenceCost += inc;
+		return *this;
+	}
+
 	inline Cost Cost::operator+( const Cost &other ) const {
-		return Cost( unsafeCost + other.unsafeCost, polyCost + other.polyCost, safeCost + other.safeCost );
+		return Cost( unsafeCost + other.unsafeCost, polyCost + other.polyCost, safeCost + other.safeCost, referenceCost + other.referenceCost );
 	}
 
 	inline Cost Cost::operator-( const Cost &other ) const {
-		return Cost( unsafeCost - other.unsafeCost, polyCost - other.polyCost, safeCost - other.safeCost );
+		return Cost( unsafeCost - other.unsafeCost, polyCost - other.polyCost, safeCost - other.safeCost, referenceCost - other.referenceCost );
 	}
 
@@ -79,4 +88,5 @@
 		polyCost += other.polyCost;
 		safeCost += other.safeCost;
+		referenceCost += other.referenceCost;
 		return *this;
 	}
@@ -98,4 +108,8 @@
 		} else if ( safeCost < other.safeCost ) {
 			return true;
+		} else if ( referenceCost > other.referenceCost ) {
+			return false;
+		} else if ( referenceCost < other.referenceCost ) {
+			return true;
 		} else {
 			return false;
@@ -106,5 +120,6 @@
 		return unsafeCost == other.unsafeCost
 			&& polyCost == other.polyCost
-			&& safeCost == other.safeCost;
+			&& safeCost == other.safeCost
+			&& referenceCost == other.referenceCost;
 	}
 
@@ -114,5 +129,5 @@
 
 	inline std::ostream &operator<<( std::ostream &os, const Cost &cost ) {
-		os << "( " << cost.unsafeCost << ", " << cost.polyCost << ", " << cost.safeCost << " )";
+		os << "( " << cost.unsafeCost << ", " << cost.polyCost << ", " << cost.safeCost << ", " << cost.referenceCost << " )";
 		return os;
 	}
