Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision fa4805fa298698201db6b7292ed9cb1cc00af9ef)
+++ src/SymTab/Validate.cc	(revision 949934ef4a9c85ee6b2393cde997ad480d65a7af)
@@ -106,6 +106,5 @@
 
 	/// Fix return types so that every function returns exactly one value
-	class ReturnTypeFixer {
-	  public:
+	struct ReturnTypeFixer {
 		static void fix( std::list< Declaration * > &translationUnit );
 
@@ -115,6 +114,5 @@
 
 	/// Replaces enum types by int, and function or array types in function parameter and return lists by appropriate pointers.
-	class EnumAndPointerDecay {
-	public:
+	struct EnumAndPointerDecay {
 		void previsit( EnumDecl *aggregateDecl );
 		void previsit( FunctionType *func );
@@ -159,10 +157,9 @@
 	};
 
-	class ReturnChecker : public WithScopes {
-	  public:
+	struct ReturnChecker : public WithGuards {
 		/// Checks that return statements return nothing if their return type is void
 		/// and return something if the return type is non-void.
 		static void checkFunctionReturns( std::list< Declaration * > & translationUnit );
-	  private:
+
 		void previsit( FunctionDecl * functionDecl );
 		void previsit( ReturnStmt * returnStmt );
@@ -205,6 +202,5 @@
 	};
 
-	class VerifyCtorDtorAssign {
-	public:
+	struct VerifyCtorDtorAssign {
 		/// ensure that constructors, destructors, and assignment have at least one
 		/// parameter, the first of which must be a pointer, and that ctor/dtors have no
@@ -216,12 +212,10 @@
 
 	/// ensure that generic types have the correct number of type arguments
-	class ValidateGenericParameters {
-	public:
+	struct ValidateGenericParameters {
 		void previsit( StructInstType * inst );
 		void previsit( UnionInstType * inst );
 	};
 
-	class ArrayLength {
-	public:
+	struct ArrayLength {
 		/// for array types without an explicit length, compute the length and store it so that it
 		/// is known to the rest of the phases. For example,
@@ -236,10 +230,9 @@
 	};
 
-	class CompoundLiteral final : public GenPoly::DeclMutator {
+	struct CompoundLiteral final : public WithDeclsToAdd, public WithVisitorRef<CompoundLiteral> {
 		Type::StorageClasses storageClasses;
 
-		using GenPoly::DeclMutator::mutate;
-		DeclarationWithType * mutate( ObjectDecl *objectDecl ) final;
-		Expression *mutate( CompoundLiteralExpr *compLitExpr ) final;
+		void premutate( ObjectDecl *objectDecl );
+		Expression * postmutate( CompoundLiteralExpr *compLitExpr );
 	};
 
@@ -248,5 +241,5 @@
 		LinkReferenceToTypes lrt( doDebug, 0 );
 		ForallPointerDecay fpd( 0 );
-		CompoundLiteral compoundliteral;
+		PassVisitor<CompoundLiteral> compoundliteral;
 		PassVisitor<ValidateGenericParameters> genericParams;
 
@@ -263,5 +256,5 @@
 		Concurrency::implementThreadStarter( translationUnit );
 		ReturnChecker::checkFunctionReturns( translationUnit );
-		compoundliteral.mutateDeclarationList( translationUnit );
+		mutateAll( translationUnit, compoundliteral );
 		acceptAll( translationUnit, fpd );
 		ArrayLength::computeLength( translationUnit );
@@ -883,22 +876,19 @@
 	}
 
-	DeclarationWithType * CompoundLiteral::mutate( ObjectDecl *objectDecl ) {
+	void CompoundLiteral::premutate( ObjectDecl *objectDecl ) {
 		storageClasses = objectDecl->get_storageClasses();
-		DeclarationWithType * temp = Mutator::mutate( objectDecl );
-		return temp;
-	}
-
-	Expression *CompoundLiteral::mutate( CompoundLiteralExpr *compLitExpr ) {
+	}
+
+	Expression *CompoundLiteral::postmutate( CompoundLiteralExpr *compLitExpr ) {
 		// transform [storage_class] ... (struct S){ 3, ... };
 		// into [storage_class] struct S temp =  { 3, ... };
 		static UniqueName indexName( "_compLit" );
 
-		ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, 0, compLitExpr->get_result(), compLitExpr->get_initializer() );
-		compLitExpr->set_result( 0 );
-		compLitExpr->set_initializer( 0 );
+		ObjectDecl *tempvar = new ObjectDecl( indexName.newName(), storageClasses, LinkageSpec::C, nullptr, compLitExpr->get_result(), compLitExpr->get_initializer() );
+		compLitExpr->set_result( nullptr );
+		compLitExpr->set_initializer( nullptr );
 		delete compLitExpr;
-		DeclarationWithType * newtempvar = mutate( tempvar );
-		addDeclaration( newtempvar );					// add modified temporary to current block
-		return new VariableExpr( newtempvar );
+		declsToAddBefore.push_back( tempvar );					// add modified temporary to current block
+		return new VariableExpr( tempvar );
 	}
 
