Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision e5609dd7cab41a2ed58e8182deb6e5f634632649)
+++ src/SymTab/Validate.cc	(revision 85c4ef0989717f74ab61b2f8edadc71d37320cd6)
@@ -10,6 +10,6 @@
 // Created On       : Sun May 17 21:50:04 2015
 // Last Modified By : Rob Schluntz
-// Last Modified On : Wed Jul 08 12:49:36 2015
-// Update Count     : 166
+// Last Modified On : Mon Jul 13 14:38:19 2015
+// Update Count     : 184
 //
 
@@ -167,4 +167,12 @@
 		virtual Type *mutate( TypeInstType *aggregateUseType );
 		virtual Expression *mutate( CastExpr *castExpr );
+
+		virtual Declaration *mutate( StructDecl * structDecl );
+		virtual Declaration *mutate( UnionDecl * unionDecl );
+		virtual Declaration *mutate( EnumDecl * enumDecl );
+		virtual Declaration *mutate( ContextDecl * contextDecl );
+
+		template<typename AggDecl>
+		AggDecl *handleAggregate( AggDecl * aggDecl );
 
 		typedef std::map< std::string, std::pair< TypedefDecl *, int > > TypedefMap;
@@ -800,5 +808,5 @@
 	}
 
-	Type *EliminateTypedef::mutate( TypeInstType *typeInst ) {
+	Type *EliminateTypedef::mutate( TypeInstType * typeInst ) {
 		// instances of typedef types will come here. If it is an instance 
 		// of a typdef type, link the instance to its actual type.
@@ -813,5 +821,5 @@
 	}
 
-	Declaration *EliminateTypedef::mutate( TypedefDecl *tyDecl ) {
+	Declaration *EliminateTypedef::mutate( TypedefDecl * tyDecl ) {
 		Declaration *ret = Mutator::mutate( tyDecl );
 		if ( typedefNames.count( tyDecl->get_name() ) == 1 && typedefNames[ tyDecl->get_name() ].second == scopeLevel ) {
@@ -823,5 +831,5 @@
 			if ( ! typeEquals( t1, t2, true ) ) {
 				throw SemanticError( "cannot redefine typedef: " + tyDecl->get_name() );
-			} 
+			}
 		} else {
 			typedefNames[ tyDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel );
@@ -845,5 +853,5 @@
 	}
 
-	TypeDecl *EliminateTypedef::mutate( TypeDecl *typeDecl ) {
+	TypeDecl *EliminateTypedef::mutate( TypeDecl * typeDecl ) {
 		TypedefMap::iterator i = typedefNames.find( typeDecl->get_name() );
 		if ( i != typedefNames.end() ) {
@@ -853,5 +861,5 @@
 	}
 
-	DeclarationWithType *EliminateTypedef::mutate( FunctionDecl *funcDecl ) {
+	DeclarationWithType *EliminateTypedef::mutate( FunctionDecl * funcDecl ) {
 		TypedefMap oldNames = typedefNames;
 		DeclarationWithType *ret = Mutator::mutate( funcDecl );
@@ -860,5 +868,5 @@
 	}
 
-	ObjectDecl *EliminateTypedef::mutate( ObjectDecl *objDecl ) {
+	ObjectDecl *EliminateTypedef::mutate( ObjectDecl * objDecl ) {
 		TypedefMap oldNames = typedefNames;
 		ObjectDecl *ret = Mutator::mutate( objDecl );
@@ -867,5 +875,5 @@
 	}
 
-	Expression *EliminateTypedef::mutate( CastExpr *castExpr ) {
+	Expression *EliminateTypedef::mutate( CastExpr * castExpr ) {
 		TypedefMap oldNames = typedefNames;
 		Expression *ret = Mutator::mutate( castExpr );
@@ -874,5 +882,5 @@
 	}
 
-	CompoundStmt *EliminateTypedef::mutate( CompoundStmt *compoundStmt ) {
+	CompoundStmt *EliminateTypedef::mutate( CompoundStmt * compoundStmt ) {
 		TypedefMap oldNames = typedefNames;
 		scopeLevel += 1;
@@ -881,6 +889,5 @@
 		std::list< Statement * >::iterator i = compoundStmt->get_kids().begin();
 		while ( i != compoundStmt->get_kids().end() ) {
-			std::list< Statement * >::iterator next = i;
-			++next;
+			std::list< Statement * >::iterator next = i+1;
 			if ( DeclStmt *declStmt = dynamic_cast< DeclStmt * >( *i ) ) {
 				if ( dynamic_cast< TypedefDecl * >( declStmt->get_decl() ) ) {
@@ -894,4 +901,42 @@
 		return ret;
 	}
+
+	// there may be typedefs nested within aggregates
+	// in order for everything to work properly, these
+	// should be removed as well
+	template<typename AggDecl>
+	AggDecl *EliminateTypedef::handleAggregate( AggDecl * aggDecl ) {
+		std::list<Declaration *>::iterator it = aggDecl->get_members().begin();
+		for ( ; it != aggDecl->get_members().end(); ) {
+			std::list< Declaration * >::iterator next = it+1;
+			if ( dynamic_cast< TypedefDecl * >( *it ) ) {
+				delete *it;
+				aggDecl->get_members().erase( it );
+			} // if
+			it = next;
+		}
+		return aggDecl;
+	}
+
+	Declaration *EliminateTypedef::mutate( StructDecl * structDecl ) {
+		Mutator::mutate( structDecl );
+		return handleAggregate( structDecl );
+	}
+
+	Declaration *EliminateTypedef::mutate( UnionDecl * unionDecl ) {
+		Mutator::mutate( unionDecl );
+		return handleAggregate( unionDecl );
+	}
+
+	Declaration *EliminateTypedef::mutate( EnumDecl * enumDecl ) {
+		Mutator::mutate( enumDecl );
+		return handleAggregate( enumDecl );
+	}
+
+		Declaration *EliminateTypedef::mutate( ContextDecl * contextDecl ) {
+		Mutator::mutate( contextDecl );
+		return handleAggregate( contextDecl );
+	}
+
 } // namespace SymTab
 
