Index: src/CodeTools/DeclStats.cc
===================================================================
--- src/CodeTools/DeclStats.cc	(revision e14d169a3f955b39b55dd5e651587d1b18aab9bb)
+++ src/CodeTools/DeclStats.cc	(revision 52a5262e330888e3eb665835b9682e7130ded8a1)
@@ -25,5 +25,4 @@
 #include "Common/PassVisitor.h"
 #include "Common/VectorMap.h"      // for VectorMap
-#include "GenPoly/GenPoly.h"       // for hasPolyBase
 #include "SynTree/LinkageSpec.h"   // for ::NoOfSpecs, Spec
 #include "SynTree/Declaration.h"   // for FunctionDecl, TypeDecl, Declaration
Index: src/GenPoly/BoxNew.cpp
===================================================================
--- src/GenPoly/BoxNew.cpp	(revision e14d169a3f955b39b55dd5e651587d1b18aab9bb)
+++ src/GenPoly/BoxNew.cpp	(revision 52a5262e330888e3eb665835b9682e7130ded8a1)
@@ -39,10 +39,4 @@
 
 namespace {
-
-/// Common field of several sub-passes of box.
-struct BoxPass {
-	TypeVarMap scopeTypeVars;
-	BoxPass() : scopeTypeVars( ast::TypeData() ) {}
-};
 
 // TODO: Could this be a common helper somewhere?
@@ -359,5 +353,4 @@
 /// * Adds appropriate type variables to the function calls.
 struct CallAdapter final :
-		public BoxPass,
 		public ast::WithConstTypeSubstitution,
 		public ast::WithGuards,
@@ -438,5 +431,5 @@
 		CodeLocation const & location, ast::Type const * type );
 
-	/// Set of adapter functions in the current scope.
+	TypeVarMap scopeTypeVars;
 	ScopedMap< std::string, ast::DeclWithType const * > adapters;
 	std::map< ast::ApplicationExpr const *, ast::Expr const * > retVals;
@@ -659,5 +652,5 @@
 	ptrdiff_t initArgCount = mutExpr->args.size();
 
-	TypeVarMap exprTypeVars = { ast::TypeData() };
+	TypeVarMap exprTypeVars;
 	// TODO: Should this take into account the variables already bound in
 	// scopeTypeVars ([ex] remove them from exprTypeVars)?
@@ -1410,5 +1403,5 @@
 
 ast::FunctionDecl const * DeclAdapter::previsit( ast::FunctionDecl const * decl ) {
-	TypeVarMap localTypeVars = { ast::TypeData() };
+	TypeVarMap localTypeVars;
 	makeTypeVarMap( decl, localTypeVars );
 
@@ -1558,5 +1551,4 @@
 	assertf( it != adapters.end(), "Could not correct floating node." );
 	return ast::mutate_field( expr, &ast::VariableExpr::var, it->second );
-
 }
 
@@ -1570,5 +1562,4 @@
 /// * Inserts dynamic calculation of polymorphic type layouts where needed.
 struct PolyGenericCalculator final :
-		public BoxPass,
 		public ast::WithConstTypeSubstitution,
 		public ast::WithDeclsToAdd<>,
@@ -1615,9 +1606,10 @@
 	/// C sizeof().
 	ast::Expr const * genSizeof( CodeLocation const &, ast::Type const * );
-
 	/// Enters a new scope for type-variables,
 	/// adding the type variables from the provided type.
 	void beginTypeScope( ast::Type const * );
 
+	/// The type variables and polymorphic parameters currently in scope.
+	TypeVarMap scopeTypeVars;
 	/// Set of generic type layouts known in the current scope,
 	/// indexed by sizeofName.
@@ -1668,5 +1660,5 @@
 		ast::TypeDecl const * decl ) {
 	ast::Type const * base = decl->base;
-	if ( nullptr == base) return decl;
+	if ( nullptr == base ) return decl;
 
 	// Add size/align variables for opaque type declarations.
@@ -1693,8 +1685,7 @@
 	alignDecl->accept( *visitor );
 
-	// Can't use [makeVar], because it inserts into stmtsToAdd and TypeDecls
-	// can occur at global scope.
+	// A little trick to replace this with two declarations.
+	// Adding after makes sure that there is no conflict with adding stmts.
 	declsToAddAfter.push_back( alignDecl );
-	// replace with sizeDecl.
 	return sizeDecl;
 }
@@ -1721,6 +1712,5 @@
 
 	// Change initialization of a polymorphic value object to allocate via a
-	// variable-length-array (alloca was previouly used, but it cannot be
-	// safely used in loops).
+	// variable-length-array (alloca cannot be safely used in loops).
 	ast::ObjectDecl * newBuf = new ast::ObjectDecl( decl->location,
 		bufNamer.newName(),
@@ -2210,5 +2200,4 @@
 /// * Strips fields from generic structure declarations.
 struct Eraser final :
-		public BoxPass,
 		public ast::WithGuards {
 	void guardTypeVarMap( ast::Type const * type ) {
@@ -2225,4 +2214,6 @@
 	void previsit( ast::PointerType const * type );
 	void previsit( ast::FunctionType const * type );
+public:
+	TypeVarMap scopeTypeVars;
 };
 
Index: src/GenPoly/GenPoly.cc
===================================================================
--- src/GenPoly/GenPoly.cc	(revision e14d169a3f955b39b55dd5e651587d1b18aab9bb)
+++ src/GenPoly/GenPoly.cc	(revision 52a5262e330888e3eb665835b9682e7130ded8a1)
@@ -273,5 +273,5 @@
 	if ( func->returns.empty() ) return nullptr;
 
-	TypeVarMap forallTypes = { ast::TypeData() };
+	TypeVarMap forallTypes;
 	makeTypeVarMap( func, forallTypes );
 	return isDynType( func->returns.front(), forallTypes );
@@ -801,5 +801,5 @@
 	const ast::FunctionType * function = getFunctionType( expr->func->result );
 	assertf( function, "ApplicationExpr has non-function type: %s", toString( expr->func->result ).c_str() );
-	TypeVarMap exprTyVars = { ast::TypeData() };
+	TypeVarMap exprTyVars;
 	makeTypeVarMap( function, exprTyVars );
 	return needsBoxing( param, arg, exprTyVars, subst );
Index: src/GenPoly/GenPoly.h
===================================================================
--- src/GenPoly/GenPoly.h	(revision e14d169a3f955b39b55dd5e651587d1b18aab9bb)
+++ src/GenPoly/GenPoly.h	(revision 52a5262e330888e3eb665835b9682e7130ded8a1)
@@ -33,5 +33,7 @@
 
 	typedef ErasableScopedMap< std::string, TypeDecl::Data > TyVarMap;
-	using TypeVarMap = ErasableScopedMap< ast::TypeEnvKey, ast::TypeData >;
+	struct TypeVarMap : public ErasableScopedMap<ast::TypeEnvKey, ast::TypeData> {
+		TypeVarMap() : ErasableScopedMap( ast::TypeData() ) {}
+	};
 
 	/// Replaces a TypeInstType by its referrent in the environment, if applicable
