Index: src/SymTab/Indexer.cc
===================================================================
--- src/SymTab/Indexer.cc	(revision d56e5bcda08aa6816d20a750cfe4087387b7681f)
+++ src/SymTab/Indexer.cc	(revision aa3d77b01f0bccec37e2709bdd14bd335e4d24ee)
@@ -493,9 +493,4 @@
 		acceptNewScope( compLitExpr->get_result(), *this );
 		maybeAccept( compLitExpr->get_initializer(), *this );
-	}
-
-	void Indexer::visit( UntypedValofExpr *valofExpr ) {
-		acceptNewScope( valofExpr->get_result(), *this );
-		maybeAccept( valofExpr->get_body(), *this );
 	}
 
Index: src/SymTab/Indexer.h
===================================================================
--- src/SymTab/Indexer.h	(revision d56e5bcda08aa6816d20a750cfe4087387b7681f)
+++ src/SymTab/Indexer.h	(revision aa3d77b01f0bccec37e2709bdd14bd335e4d24ee)
@@ -69,5 +69,4 @@
 		virtual void visit( ConstructorExpr * ctorExpr );
 		virtual void visit( CompoundLiteralExpr *compLitExpr );
-		virtual void visit( UntypedValofExpr *valofExpr );
 		virtual void visit( RangeExpr *rangeExpr );
 		virtual void visit( UntypedTupleExpr *tupleExpr );
Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision d56e5bcda08aa6816d20a750cfe4087387b7681f)
+++ src/SymTab/Validate.cc	(revision aa3d77b01f0bccec37e2709bdd14bd335e4d24ee)
@@ -115,8 +115,8 @@
 
 	/// Replaces enum types by int, and function or array types in function parameter and return lists by appropriate pointers.
-	class EnumAndPointerDecayPass final : public Visitor {
-		typedef Visitor Parent;
-		virtual void visit( EnumDecl *aggregateDecl );
-		virtual void visit( FunctionType *func );
+	class EnumAndPointerDecay {
+	public:
+		void previsit( EnumDecl *aggregateDecl );
+		void previsit( FunctionType *func );
 	};
 
@@ -126,5 +126,4 @@
 	  public:
 		LinkReferenceToTypes( bool doDebug, const Indexer *indexer );
-	  private:
   		using Parent::visit;
 		void visit( EnumInstType *enumInst ) final;
@@ -136,5 +135,5 @@
 		void visit( UnionDecl *unionDecl ) final;
 		void visit( TypeInstType *typeInst ) final;
-
+	  private:
 		const Indexer *indexer;
 
@@ -147,11 +146,11 @@
 	};
 
-	/// Replaces array and function types in forall lists by appropriate pointer type
-	class Pass3 final : public Indexer {
+	/// Replaces array and function types in forall lists by appropriate pointer type and assigns each Object and Function declaration a unique ID.
+	class ForallPointerDecay final : public Indexer {
 		typedef Indexer Parent;
 	  public:
 	  	using Parent::visit;
-		Pass3( const Indexer *indexer );
-	  private:
+		ForallPointerDecay( const Indexer *indexer );
+
 		virtual void visit( ObjectDecl *object ) override;
 		virtual void visit( FunctionDecl *func ) override;
@@ -160,5 +159,5 @@
 	};
 
-	class ReturnChecker {
+	class ReturnChecker : public WithScopes {
 	  public:
 		/// Checks that return statements return nothing if their return type is void
@@ -167,10 +166,8 @@
 	  private:
 		void previsit( FunctionDecl * functionDecl );
-		void postvisit( FunctionDecl * functionDecl );
 		void previsit( ReturnStmt * returnStmt );
 
 		typedef std::list< DeclarationWithType * > ReturnVals;
 		ReturnVals returnVals;
-		std::stack< ReturnVals > returnValsStack;
 	};
 
@@ -248,7 +245,7 @@
 
 	void validate( std::list< Declaration * > &translationUnit, bool doDebug ) {
-		EnumAndPointerDecayPass epc;
+		PassVisitor<EnumAndPointerDecay> epc;
 		LinkReferenceToTypes lrt( doDebug, 0 );
-		Pass3 pass3( 0 );
+		ForallPointerDecay fpd( 0 );
 		CompoundLiteral compoundliteral;
 		PassVisitor<ValidateGenericParameters> genericParams;
@@ -262,20 +259,20 @@
 		VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
 		Concurrency::applyKeywords( translationUnit );
-		autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecayPass
+		autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
 		Concurrency::implementMutexFuncs( translationUnit );
 		Concurrency::implementThreadStarter( translationUnit );
 		ReturnChecker::checkFunctionReturns( translationUnit );
 		compoundliteral.mutateDeclarationList( translationUnit );
-		acceptAll( translationUnit, pass3 );
+		acceptAll( translationUnit, fpd );
 		ArrayLength::computeLength( translationUnit );
 	}
 
 	void validateType( Type *type, const Indexer *indexer ) {
-		EnumAndPointerDecayPass epc;
+		PassVisitor<EnumAndPointerDecay> epc;
 		LinkReferenceToTypes lrt( false, indexer );
-		Pass3 pass3( indexer );
+		ForallPointerDecay fpd( indexer );
 		type->accept( epc );
 		type->accept( lrt );
-		type->accept( pass3 );
+		type->accept( fpd );
 	}
 
@@ -356,5 +353,5 @@
 	}
 
-	void EnumAndPointerDecayPass::visit( EnumDecl *enumDecl ) {
+	void EnumAndPointerDecay::previsit( EnumDecl *enumDecl ) {
 		// Set the type of each member of the enumeration to be EnumConstant
 		for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) {
@@ -363,5 +360,4 @@
 			obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl->get_name() ) );
 		} // for
-		Parent::visit( enumDecl );
 	}
 
@@ -370,5 +366,5 @@
 		void fixFunctionList( DWTList & dwts, FunctionType * func ) {
 			// the only case in which "void" is valid is where it is the only one in the list; then it should be removed
-			// entirely other fix ups are handled by the FixFunction class
+			// entirely. other fix ups are handled by the FixFunction class
 			typedef typename DWTList::iterator DWTIterator;
 			DWTIterator begin( dwts.begin() ), end( dwts.end() );
@@ -389,5 +385,5 @@
 				for ( ; i != end; ++i ) {
 					FixFunction fixer;
-					*i = (*i )->acceptMutator( fixer );
+					*i = (*i)->acceptMutator( fixer );
 					if ( fixer.get_isVoid() ) {
 						throw SemanticError( "invalid type void in function type ", func );
@@ -398,9 +394,8 @@
 	}
 
-	void EnumAndPointerDecayPass::visit( FunctionType *func ) {
+	void EnumAndPointerDecay::previsit( FunctionType *func ) {
 		// Fix up parameters and return types
 		fixFunctionList( func->get_parameters(), func );
 		fixFunctionList( func->get_returnVals(), func );
-		Visitor::visit( func );
 	}
 
@@ -549,5 +544,5 @@
 	}
 
-	Pass3::Pass3( const Indexer *other_indexer ) :  Indexer( false ) {
+	ForallPointerDecay::ForallPointerDecay( const Indexer *other_indexer ) :  Indexer( false ) {
 		if ( other_indexer ) {
 			indexer = other_indexer;
@@ -587,5 +582,5 @@
 	}
 
-	void Pass3::visit( ObjectDecl *object ) {
+	void ForallPointerDecay::visit( ObjectDecl *object ) {
 		forallFixer( object->get_type() );
 		if ( PointerType *pointer = dynamic_cast< PointerType * >( object->get_type() ) ) {
@@ -596,5 +591,5 @@
 	}
 
-	void Pass3::visit( FunctionDecl *func ) {
+	void ForallPointerDecay::visit( FunctionDecl *func ) {
 		forallFixer( func->get_type() );
 		Parent::visit( func );
@@ -608,10 +603,6 @@
 
 	void ReturnChecker::previsit( FunctionDecl * functionDecl ) {
-		returnValsStack.push( returnVals );
+		GuardValue( returnVals );
 		returnVals = functionDecl->get_functionType()->get_returnVals();
-	}
-	void ReturnChecker::postvisit( __attribute__((unused)) FunctionDecl * functionDecl ) {
-		returnVals = returnValsStack.top();
-		returnValsStack.pop();
 	}
 
