Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision 4e06c1ebfdf762654ec91b9a78bae607f25fba19)
+++ src/GenPoly/Box.cc	(revision 9799ec895018b6521379a30bde094fce6d31bf69)
@@ -619,5 +619,5 @@
 			return 0;
 		}
-		
+
 		/// Returns T if the given declaration is a function with parameters (T*, T) for some TypeInstType T, NULL otherwise
 		TypeInstType *isTypeInstPtrValFn( DeclarationWithType *decl ) {
@@ -637,5 +637,5 @@
 			return 0;
 		}
-		
+
 		/// Returns T if the given declaration is (*?=?)(T *, T) for some TypeInstType T (return not checked, but maybe should be), NULL otherwise
 		TypeInstType *isTypeInstAssignment( DeclarationWithType *decl ) {
@@ -677,5 +677,5 @@
 			return 0;
 		}
-		
+
 		/// Returns T if the given declaration is a function with parameters (T*, T) for some type T, where neither parameter is cv-qualified,
 		/// NULL otherwise
@@ -772,5 +772,5 @@
 				copyOps.beginScope();
 				dtorOps.beginScope();
-				
+
 				DeclarationWithType *oldRetval = retval;
 				bool oldUseRetval = useRetval;
@@ -1471,7 +1471,9 @@
 		VariableExpr *wrapFunctionDecl( DeclarationWithType *functionDecl ) {
 			// line below cloned from FixFunction.cc
+			// xxx - functionObj is never added to a list of declarations...
 			ObjectDecl *functionObj = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClass(), functionDecl->get_linkage(), 0,
 			                                          new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0 );
 			functionObj->set_mangleName( functionDecl->get_mangleName() );
+			functionObj->set_scopeLevel( functionDecl->get_scopeLevel() );
 			return new VariableExpr( functionObj );
 		}
@@ -1492,5 +1494,5 @@
 					= ParamEntry( assertOp->get_uniqueId(), assertOp->get_type()->clone(), actualDecl->get_type()->clone(), wrapFunctionDecl( assertOp ) );
 		}
-		
+
 		Statement * Pass1::mutate( ReturnStmt *returnStmt ) {
 			if ( retval && returnStmt->get_expr() ) {
@@ -1554,5 +1556,5 @@
 						DeclarationWithType *assertDtor = findOpForType( formalType, dtorOps, scopedDtorOps );
 						if ( ! assertDtor ) throw SemanticError( "No destructor found for ", formalType );
-						
+
 						// add inferred parameters for otype operators to assignment expression
 						// NOTE: Code here assumes that first four assertions are assign op, ctor, copy ctor, dtor, in that order
@@ -1568,8 +1570,5 @@
 						++actualIt;
 						addAssertionFor( assignExpr, *actualIt, assertDtor );
-						
-						//DeclarationWithType *actualDecl = asserts.front();
-						//assignExpr->get_inferParams()[ actualDecl->get_uniqueId() ]
-						//	= ParamEntry( assertAssign->get_uniqueId(), assertAssign->get_type()->clone(), actualDecl->get_type()->clone(), wrapFunctionDecl( assertAssign ) );
+
 					}
 				}
@@ -2181,5 +2180,5 @@
 		bool PolyGenericCalculator::findGeneric( Type *ty ) {
 			ty = replaceTypeInst( ty, env );
-			
+
 			if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( ty ) ) {
 				if ( scopeTyVars.find( typeInst->get_name() ) != scopeTyVars.end() ) {
