Index: src/CodeGen/Generate.cc
===================================================================
--- src/CodeGen/Generate.cc	(revision 97f65d5c634e6bc9c5682e558000e5473fa122cb)
+++ src/CodeGen/Generate.cc	(revision e6512c8966c9469a0d71ef9ff94e01b78a3f68fb)
@@ -22,4 +22,5 @@
 #include "SynTree/Declaration.h"
 #include "CodeGenerator.h"
+#include "Tuples/Tuples.h"
 
 using namespace std;
@@ -28,9 +29,8 @@
 	void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty ) {
 		CodeGen::CodeGenerator cgv( os, pretty );
-
-		for ( std::list<Declaration *>::iterator i = translationUnit.begin(); i != translationUnit.end();  i++ ) {
-			if ( LinkageSpec::isGeneratable( (*i)->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( (*i)->get_linkage() ) ) ) {
-				(*i)->accept(cgv);
-				if ( doSemicolon( *i ) ) {
+		for ( auto & dcl : translationUnit ) {
+			if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) {
+				dcl->accept(cgv);
+				if ( doSemicolon( dcl ) ) {
 					os << ";";
 				} // if
Index: src/Tuples/TupleExpansion.cc
===================================================================
--- src/Tuples/TupleExpansion.cc	(revision 97f65d5c634e6bc9c5682e558000e5473fa122cb)
+++ src/Tuples/TupleExpansion.cc	(revision e6512c8966c9469a0d71ef9ff94e01b78a3f68fb)
@@ -79,5 +79,5 @@
 			}
 		  private:
-			ScopedMap< std::string, StructDecl * > typeMap;
+			ScopedMap< int, StructDecl * > typeMap;
 		};
 
@@ -214,26 +214,25 @@
 
 	Type * TupleTypeReplacer::mutate( TupleType * tupleType ) {
-		std::string mangleName = SymTab::Mangler::mangleType( tupleType );
 		tupleType = safe_dynamic_cast< TupleType * > ( Parent::mutate( tupleType ) );
-		if ( ! typeMap.count( mangleName ) ) {
-			// generate struct type to replace tuple type
-			// xxx - should fix this to only generate one tuple struct for each number of type parameters
-			StructDecl * decl = new StructDecl( "_tuple_type_" + mangleName );
+		unsigned tupleSize = tupleType->size();
+		if ( ! typeMap.count( tupleSize ) ) {
+			// generate struct type to replace tuple type based on the number of components in the tuple
+			StructDecl * decl = new StructDecl( toString( "_tuple_type_", tupleSize  ) );
 			decl->set_body( true );
-			for ( size_t i = 0; i < tupleType->size(); ++i ) {
+			for ( size_t i = 0; i < tupleSize; ++i ) {
 				TypeDecl * tyParam = new TypeDecl( toString("tuple_param_", i), DeclarationNode::NoStorageClass, nullptr, TypeDecl::Any );
 				decl->get_members().push_back( new ObjectDecl( toString("field_", i), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new TypeInstType( Type::Qualifiers(), tyParam->get_name(), tyParam ), nullptr ) );
 				decl->get_parameters().push_back( tyParam );
 			}
-			if ( tupleType->size() == 0 ) {
+			if ( tupleSize == 0 ) {
 				// empty structs are not standard C. Add a dummy field to empty tuples to silence warnings when a compound literal Tuple0 is created.
 				decl->get_members().push_back( new ObjectDecl( "dummy", DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
 			}
-			typeMap[mangleName] = decl;
+			typeMap[tupleSize] = decl;
 			addDeclaration( decl );
 		}
 		Type::Qualifiers qualifiers = tupleType->get_qualifiers();
 
-		StructDecl * decl = typeMap[mangleName];
+		StructDecl * decl = typeMap[tupleSize];
 		StructInstType * newType = new StructInstType( qualifiers, decl );
 		for ( Type * t : *tupleType ) {
