Index: src/AST/Eval.hpp
===================================================================
--- src/AST/Eval.hpp	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
+++ src/AST/Eval.hpp	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -0,0 +1,37 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// Eval.hpp --
+//
+// Author           : Aaron B. Moss
+// Created On       : Fri Jun 28 14:00:00 2019
+// Last Modified By : Aaron B. Moss
+// Created On       : Fri Jun 28 14:00:00 2019
+// Update Count     : 1
+//
+
+#include <string>
+#include <utility>
+
+#include "Expr.hpp"
+
+namespace ast {
+
+/// Create a new UntypedExpr with the given arguments
+template< typename... Args >
+UntypedExpr * call( const CodeLocation & loc, const std::string & name, Args &&... args ) {
+	return new UntypedExpr { 
+		loc, new NameExpr { loc, name }, 
+		std::vector< ptr< Expr > > { std::forward< Args >( args )... } };
+}
+
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/AST/Expr.cpp
===================================================================
--- src/AST/Expr.cpp	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/AST/Expr.cpp	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -20,4 +20,5 @@
 #include <vector>
 
+#include "Eval.hpp"                // for call
 #include "GenericSubstitution.hpp"
 #include "Stmt.hpp"
@@ -51,7 +52,5 @@
 	assert( arg );
 
-	UntypedExpr * ret = new UntypedExpr{
-		loc, new NameExpr{loc, "*?"}, std::vector<ptr<Expr>>{ ptr<Expr>{ arg } }
-	};
+	UntypedExpr * ret = call( loc, "*?", arg );
 	if ( const Type * ty = arg->result ) {
 		const Type * base = InitTweak::getPointerBase( ty );
@@ -74,7 +73,5 @@
 	assert( lhs && rhs );
 
-	UntypedExpr * ret = new UntypedExpr{
-		loc, new NameExpr{loc, "?=?"}, std::vector<ptr<Expr>>{ ptr<Expr>{ lhs }, ptr<Expr>{ rhs } }
-	};
+	UntypedExpr * ret = call( loc, "?=?", lhs, rhs );
 	if ( lhs->result && rhs->result ) {
 		// if both expressions are typed, assumes that this assignment is a C bitwise assignment,
Index: src/AST/Pass.impl.hpp
===================================================================
--- src/AST/Pass.impl.hpp	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/AST/Pass.impl.hpp	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -1920,5 +1920,5 @@
 				guard_symtab guard { *this };
 				auto new_node = p.second->accept( *this );
-				if (new_node != p.second) mutated = false;
+				if (new_node != p.second) mutated = true;
 				new_map.insert({ p.first, new_node });
 			}
@@ -1936,5 +1936,5 @@
 				guard_symtab guard { *this };
 				auto new_node = p.second->accept( *this );
-				if (new_node != p.second) mutated = false;
+				if (new_node != p.second) mutated = true;
 				new_map.insert({ p.first, new_node });
 			}
Index: src/AST/TypeSubstitution.cpp
===================================================================
--- src/AST/TypeSubstitution.cpp	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/AST/TypeSubstitution.cpp	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -183,7 +183,6 @@
 		// bind type variables from generic type instantiations
 		if ( auto decl = type->aggr() ) {
-			const std::vector<ptr<TypeDecl>> &baseParameters =  decl->params;
-			if (! type->params.empty()) {
-				for ( const TypeDecl * tyvar : baseParameters ) {
+			if ( ! type->params.empty() ) {
+				for ( const TypeDecl * tyvar : decl->params ) {
 					boundVars.insert( tyvar->name );
 				} // for
Index: src/ResolvExpr/CandidateFinder.cpp
===================================================================
--- src/ResolvExpr/CandidateFinder.cpp	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/ResolvExpr/CandidateFinder.cpp	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -370,7 +370,5 @@
 							// push empty tuple expression
 							newResult.parent = i;
-							std::vector< ast::ptr< ast::Expr > > emptyList;
-							newResult.expr = 
-								new ast::TupleExpr{ CodeLocation{}, move( emptyList ) };
+							newResult.expr = new ast::TupleExpr{ CodeLocation{}, {} };
 							argType = newResult.expr->result;
 						} else {
Index: src/ResolvExpr/ResolveTypeof.cc
===================================================================
--- src/ResolvExpr/ResolveTypeof.cc	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/ResolvExpr/ResolveTypeof.cc	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -153,5 +153,5 @@
 			}
 
-			return newType;
+			return newType.release();
 		}
 	};
Index: src/ResolvExpr/Resolver.cc
===================================================================
--- src/ResolvExpr/Resolver.cc	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/ResolvExpr/Resolver.cc	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -1109,5 +1109,5 @@
 		
 		// set up and resolve expression cast to void
-		ast::CastExpr * untyped = new ast::CastExpr{ expr };
+		ast::ptr< ast::CastExpr > untyped = new ast::CastExpr{ expr };
 		CandidateRef choice = findUnfinishedKindExpression( 
 			untyped, symtab, "", anyCandidate, ResolvMode::withAdjustment() );
@@ -1248,5 +1248,5 @@
 	};
 
-	void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit ) {
+	void resolve( std::list< ast::ptr< ast::Decl > >& translationUnit ) {
 		ast::Pass< Resolver_new > resolver;
 		accept_all( translationUnit, resolver );
@@ -1282,5 +1282,5 @@
 		ast::ptr< ast::FunctionDecl > ret = functionDecl;
 		for ( unsigned i = 0; i < functionDecl->type->params.size(); ++i ) {
-			const ast::ptr<ast::DeclWithType> & d = functionDecl->type->params[i];
+			const ast::ptr< ast::DeclWithType > & d = functionDecl->type->params[i];
 
 			if ( const ast::ObjectDecl * obj = d.as< ast::ObjectDecl >() ) {
@@ -1299,5 +1299,5 @@
 			}
 		}
-		return ret.get();
+		return ret.release();
 	}
 
Index: src/SymTab/Autogen.h
===================================================================
--- src/SymTab/Autogen.h	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/SymTab/Autogen.h	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -21,4 +21,5 @@
 
 #include "AST/Decl.hpp"
+#include "AST/Eval.hpp"
 #include "AST/Expr.hpp"
 #include "AST/Init.hpp"
@@ -264,5 +265,6 @@
 		}
 
-		ast::ptr< ast::Expr > begin, end, cmp, update;
+		ast::ptr< ast::Expr > begin, end;
+		std::string cmp, update;
 
 		if ( forward ) {
@@ -270,14 +272,13 @@
 			begin = ast::ConstantExpr::from_int( loc, 0 );
 			end = array->dimension;
-			cmp = new ast::NameExpr{ loc, "?<?" };
-			update = new ast::NameExpr{ loc, "++?" };
+			cmp = "?<?";
+			update = "++?";
 		} else {
 			// generate: for ( int i = N-1; i >= 0; --i )
-			begin = new ast::UntypedExpr{ 
-				loc, new ast::NameExpr{ loc, "?-?" }, 
-				{ array->dimension, ast::ConstantExpr::from_int( loc, 1 ) } };
+			begin = ast::call( 
+				loc, "?-?", array->dimension, ast::ConstantExpr::from_int( loc, 1 ) );
 			end = ast::ConstantExpr::from_int( loc, 0 );
-			cmp = new ast::NameExpr{ loc, "?>=?" };
-			update = new ast::NameExpr{ loc, "--?" };
+			cmp = "?>=?";
+			update = "--?";
 		}
 
@@ -285,18 +286,15 @@
 			loc, indexName.newName(), new ast::BasicType{ ast::BasicType::SignedInt }, 
 			new ast::SingleInit{ loc, begin } };
-		
-		ast::ptr< ast::Expr > cond = new ast::UntypedExpr{
-			loc, cmp, { new ast::VariableExpr{ loc, index }, end } };
-		
-		ast::ptr< ast::Expr > inc = new ast::UntypedExpr{
-			loc, update, { new ast::VariableExpr{ loc, index } } };
-		
-		ast::ptr< ast::Expr > dstIndex = new ast::UntypedExpr{
-			loc, new ast::NameExpr{ loc, "?[?]" }, 
-			{ dstParam, new ast::VariableExpr{ loc, index } } };
+		ast::ptr< ast::Expr > indexVar = new ast::VariableExpr{ loc, index };
+		
+		ast::ptr< ast::Expr > cond = ast::call( loc, cmp, indexVar, end );
+		
+		ast::ptr< ast::Expr > inc = ast::call( loc, update, indexVar );
+		
+		ast::ptr< ast::Expr > dstIndex = ast::call( loc, "?[?]", dstParam, indexVar );
 		
 		// srcParam must keep track of the array indices to build the source parameter and/or 
 		// array list initializer
-		srcParam.addArrayIndex( new ast::VariableExpr{ loc, index }, array->dimension );
+		srcParam.addArrayIndex( indexVar, array->dimension );
 
 		// for stmt's body, eventually containing call
@@ -384,5 +382,5 @@
 		if ( isUnnamedBitfield( obj ) ) return {};
 
-		ast::ptr< ast::Type > addCast = nullptr;
+		ast::ptr< ast::Type > addCast;
 		if ( (fname == "?{}" || fname == "^?{}") && ( ! obj || ( obj && ! obj->bitfieldWidth ) ) ) {
 			assert( dstParam->result );
Index: src/Tuples/Explode.cc
===================================================================
--- src/Tuples/Explode.cc	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/Tuples/Explode.cc	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -129,5 +129,4 @@
 			for ( const ast::Expr * expr : tupleExpr->exprs ) {
 				exprs.emplace_back( applyCast( expr, false ) );
-				//exprs.emplace_back( ast::ptr< ast::Expr >( applyCast( expr, false ) ) );
 			}
 			if ( first ) {
Index: src/Tuples/Explode.h
===================================================================
--- src/Tuples/Explode.h	(revision 55b64769d5e1c45cb4b5d7f0b3dfa82322d8f3d2)
+++ src/Tuples/Explode.h	(revision 417117ea3f54c45c0a3977a8ca6d9f0924f73be9)
@@ -210,5 +210,5 @@
 			}
 			// Cast a reference away to a value-type to allow further explosion.
-			if ( dynamic_cast< const ast::ReferenceType *>( local->result.get() ) ) {
+			if ( local->result.as< ast::ReferenceType >() ) {
 				local = new ast::CastExpr{ local, tupleType };
 			}
@@ -220,5 +220,4 @@
 				// delete idx;
 			}
-			// delete local;
 		}
 	} else {
