Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision cc3528fa256fee8ec5d85fea52117f5a7355a2da)
+++ src/GenPoly/Box.cc	(revision 189243cfaff5225ff3efc85e4584d03a44e8583c)
@@ -10,5 +10,5 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Rob Schluntz
-// Last Modified On : Fri May 13 13:59:22 2016
+// Last Modified On : Fri May 13 14:51:21 2016
 // Update Count     : 295
 //
@@ -784,5 +784,6 @@
 						arg++;
 					} else {
-						throw SemanticError( "unbound type variable in application ", appExpr );
+						/// xxx - should this be an assertion?
+						throw SemanticError( "unbound type variable: " + tyParm->first + " in application ", appExpr );
 					} // if
 				} // if
@@ -910,4 +911,5 @@
 				} else if ( arg->get_results().front()->get_isLvalue() ) {
 					// VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue)
+					// xxx - need to test that this code is still reachable
 					if ( CommaExpr *commaArg = dynamic_cast< CommaExpr* >( arg ) ) {
 						commaArg->set_arg2( new AddressExpr( commaArg->get_arg2() ) );
@@ -1293,8 +1295,6 @@
 			} else if ( needsAdapter( function, scopeTyVars ) ) {
 				// std::cerr << "needs adapter: ";
-				// for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
-				// 	std::cerr << i->first << " ";
-				// }
-				// std::cerr << "\n";
+				// printTyVarMap( std::cerr, scopeTyVars );
+				// std::cerr << *env << std::endl;
 				// change the application so it calls the adapter rather than the passed function
 				ret = applyAdapter( appExpr, function, arg, scopeTyVars );
@@ -1347,6 +1347,9 @@
 				} // if
 			} // if
+			// isPolyType check needs to happen before mutating addrExpr arg, so pull it forward
+			// out of the if condition.
+			bool polytype = isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env );
 			addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) );
-			if ( isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env ) || needs ) {
+			if ( polytype || needs ) {
 				Expression *ret = addrExpr->get_arg();
 				delete ret->get_results().front();
@@ -1907,5 +1910,5 @@
 
 					std::list<Expression*> designators;
-					objectDecl->set_init( new SingleInit( alloc, designators ) );
+					objectDecl->set_init( new SingleInit( alloc, designators, false ) ); // not constructed
 				}
 			}
Index: src/GenPoly/CopyParams.cc
===================================================================
--- src/GenPoly/CopyParams.cc	(revision cc3528fa256fee8ec5d85fea52117f5a7355a2da)
+++ src/GenPoly/CopyParams.cc	(revision 189243cfaff5225ff3efc85e4584d03a44e8583c)
@@ -5,9 +5,9 @@
 // file "LICENCE" distributed with Cforall.
 //
-// CopyParams.cc -- 
+// CopyParams.cc --
 //
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
+// Last Modified By : Rob Schluntz
 // Last Modified On : Tue May 19 07:33:31 2015
 // Update Count     : 1
@@ -29,5 +29,5 @@
 	  public:
 		CopyParams();
-  
+
 		virtual void visit( FunctionDecl *funcDecl );
 		virtual void visit( AddressExpr *addrExpr );
@@ -50,5 +50,5 @@
 		if ( funcDecl->get_statements() ) {
 			funcDecl->get_statements()->accept( *this );
-	
+
 			if ( ! modVars.empty() ) {
 				std::map< std::string, DeclarationWithType* > assignOps;
@@ -57,4 +57,5 @@
 					if ( (*tyVar)->get_kind() == TypeDecl::Any ) {
 						assert( !(*tyVar)->get_assertions().empty() );
+						assert( (*tyVar)->get_assertions().front()->get_name() == "?=?" );
 						assignOps[ (*tyVar)->get_name() ] = (*tyVar)->get_assertions().front();
 					} // if
Index: src/GenPoly/GenPoly.cc
===================================================================
--- src/GenPoly/GenPoly.cc	(revision cc3528fa256fee8ec5d85fea52117f5a7355a2da)
+++ src/GenPoly/GenPoly.cc	(revision 189243cfaff5225ff3efc85e4584d03a44e8583c)
@@ -5,10 +5,10 @@
 // file "LICENCE" distributed with Cforall.
 //
-// GenPoly.cc -- 
+// GenPoly.cc --
 //
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 15 16:11:18 2015
+// Last Modified By : Rob Schluntz
+// Last Modified On : Mon May 02 14:53:33 2016
 // Update Count     : 13
 //
@@ -81,5 +81,5 @@
 		return 0;
 	}
-	
+
 	Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {
 		if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) {
@@ -112,5 +112,5 @@
 		return 0;
 	}
-	
+
 	Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {
 		if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) {
@@ -146,5 +146,5 @@
 		return isPolyType( type, env );
 	}
-	
+
 	Type * hasPolyBase( Type *type, const TyVarMap &tyVars, int *levels, const TypeSubstitution *env ) {
 		int dummy;
@@ -192,4 +192,8 @@
 				if ( ! fn || fn->get_name() != std::string("*?") ) return 0;
 				expr = *untypedExpr->begin_args();
+			} else if ( CommaExpr *commaExpr = dynamic_cast< CommaExpr* >( expr ) ) {
+				// copy constructors insert comma exprs, look at second argument which contains the variable
+				expr = commaExpr->get_arg2();
+				continue;
 			} else break;
 
@@ -209,5 +213,5 @@
 		}
 	}
-	
+
 	void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap ) {
 		for ( TyVarMap::const_iterator i = tyVarMap.begin(); i != tyVarMap.end(); ++i ) {
Index: src/GenPoly/PolyMutator.cc
===================================================================
--- src/GenPoly/PolyMutator.cc	(revision cc3528fa256fee8ec5d85fea52117f5a7355a2da)
+++ src/GenPoly/PolyMutator.cc	(revision 189243cfaff5225ff3efc85e4584d03a44e8583c)
@@ -5,10 +5,10 @@
 // file "LICENCE" distributed with Cforall.
 //
-// PolyMutator.cc -- 
+// PolyMutator.cc --
 //
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Rob Schluntz
-// Last Modified On : Fri Aug 14 15:28:50 2015
+// Last Modified On : Mon May 02 14:50:58 2016
 // Update Count     : 11
 //
@@ -63,4 +63,5 @@
 				env = expr->get_env();
 			}
+			// xxx - should env be cloned (or moved) onto the result of the mutate?
 			return expr->acceptMutator( *this );
 		} else {
@@ -144,6 +145,6 @@
 		return untypedExpr;
 	}
- 
- 
+
+
 	Initializer *PolyMutator::mutate( SingleInit *singleInit ) {
 		singleInit->set_value( mutateExpression( singleInit->get_value() ) );
Index: src/GenPoly/Specialize.cc
===================================================================
--- src/GenPoly/Specialize.cc	(revision cc3528fa256fee8ec5d85fea52117f5a7355a2da)
+++ src/GenPoly/Specialize.cc	(revision 189243cfaff5225ff3efc85e4584d03a44e8583c)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Rob Schluntz
-// Last Modified On : Wed Jan 20 12:40:33 2016
-// Update Count     : 18
+// Last Modified On : Thu Apr 28 15:17:45 2016
+// Update Count     : 24
 //
 
@@ -41,7 +41,7 @@
 		virtual Expression * mutate( AddressExpr *castExpr );
 		virtual Expression * mutate( CastExpr *castExpr );
-		virtual Expression * mutate( LogicalExpr *logicalExpr );
-		virtual Expression * mutate( ConditionalExpr *conditionalExpr );
-		virtual Expression * mutate( CommaExpr *commaExpr );
+		// virtual Expression * mutate( LogicalExpr *logicalExpr );
+		// virtual Expression * mutate( ConditionalExpr *conditionalExpr );
+		// virtual Expression * mutate( CommaExpr *commaExpr );
 
 	  private:
@@ -142,5 +142,5 @@
 
 	Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
-		assert( ! actual->get_results().empty() );
+		assert( ! actual->get_results().empty() ); // using front, should have this assert
 		if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) {
 			FunctionType *funType;
@@ -212,15 +212,19 @@
 	}
 
-	Expression * Specialize::mutate( LogicalExpr *logicalExpr ) {
-		return logicalExpr;
-	}
-
-	Expression * Specialize::mutate( ConditionalExpr *condExpr ) {
-		return condExpr;
-	}
-
-	Expression * Specialize::mutate( CommaExpr *commaExpr ) {
-		return commaExpr;
-	}
+	// Removing these for now. Richard put these in for some reason, but it's not clear why.
+	// In particular, copy constructors produce a comma expression, and with this code the parts
+	// of that comma expression are not specialized, which causes problems.
+
+	// Expression * Specialize::mutate( LogicalExpr *logicalExpr ) {
+	// 	return logicalExpr;
+	// }
+
+	// Expression * Specialize::mutate( ConditionalExpr *condExpr ) {
+	// 	return condExpr;
+	// }
+
+	// Expression * Specialize::mutate( CommaExpr *commaExpr ) {
+	// 	return commaExpr;
+	// }
 } // namespace GenPoly
 
