Index: src/SymTab/GenImplicitCall.cpp
===================================================================
--- src/SymTab/GenImplicitCall.cpp	(revision 0522ebe7b3ae7204a1d2c50a1bc7273bfa36762a)
+++ src/SymTab/GenImplicitCall.cpp	(revision d9bad5125c27fa032a8711a3c60c7d6c14d7d39e)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// GenImplicitCall.hpp --
+// GenImplicitCall.cpp -- Generate code for implicit operator calls.
 //
 // Author           : Andrew Beach
@@ -31,8 +31,9 @@
 namespace {
 
-template< typename OutIter >
+using Inserter = std::back_insert_iterator<std::list<ast::ptr<ast::Stmt>>>;
+
 ast::ptr< ast::Stmt > genCall(
 	InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
-	const CodeLocation & loc, const std::string & fname, OutIter && out,
+	const CodeLocation & loc, const std::string & fname, Inserter && out,
 	const ast::Type * type, const ast::Type * addCast, LoopDirection forward = LoopForward );
 
@@ -41,8 +42,7 @@
 /// optionally returns a statement which must be inserted prior to the containing loop, if
 /// there is one
-template< typename OutIter >
 ast::ptr< ast::Stmt > genScalarCall(
 	InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
-	const CodeLocation & loc, std::string fname, OutIter && out, const ast::Type * type,
+	const CodeLocation & loc, std::string fname, Inserter && out, const ast::Type * type,
 	const ast::Type * addCast = nullptr
 ) {
@@ -97,8 +97,7 @@
 /// Store in out a loop which calls fname on each element of the array with srcParam and
 /// dstParam as arguments. If forward is true, loop goes from 0 to N-1, else N-1 to 0
-template< typename OutIter >
 void genArrayCall(
 	InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
-	const CodeLocation & loc, const std::string & fname, OutIter && out,
+	const CodeLocation & loc, const std::string & fname, Inserter && out,
 	const ast::ArrayType * array, const ast::Type * addCast = nullptr,
 	LoopDirection forward = LoopForward
@@ -166,18 +165,17 @@
 }
 
-template< typename OutIter >
 ast::ptr< ast::Stmt > genCall(
 	InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
-	const CodeLocation & loc, const std::string & fname, OutIter && out,
+	const CodeLocation & loc, const std::string & fname, Inserter && out,
 	const ast::Type * type, const ast::Type * addCast, LoopDirection forward
 ) {
 	if ( auto at = dynamic_cast< const ast::ArrayType * >( type ) ) {
 		genArrayCall(
-			srcParam, dstParam, loc, fname, std::forward< OutIter >(out), at, addCast,
+			srcParam, dstParam, loc, fname, std::forward< Inserter&& >( out ), at, addCast,
 			forward );
 		return {};
 	} else {
 		return genScalarCall(
-			srcParam, dstParam, loc, fname, std::forward< OutIter >( out ), type, addCast );
+			srcParam, dstParam, loc, fname, std::forward< Inserter&& >( out ), type, addCast );
 	}
 }
@@ -185,5 +183,5 @@
 } // namespace
 
-ast::ptr< ast::Stmt > genImplicitCall(
+const ast::Stmt * genImplicitCall(
 	InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
 	const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * obj,
@@ -191,5 +189,5 @@
 ) {
 	// unnamed bit fields are not copied as they cannot be accessed
-	if ( isUnnamedBitfield( obj ) ) return {};
+	if ( isUnnamedBitfield( obj ) ) return nullptr;
 
 	ast::ptr< ast::Type > addCast;
@@ -199,22 +197,18 @@
 	}
 
-	std::vector< ast::ptr< ast::Stmt > > stmts;
+	std::list< ast::ptr< ast::Stmt > > stmts;
 	genCall(
 		srcParam, dstParam, loc, fname, back_inserter( stmts ), obj->type, addCast, forward );
 
-	if ( stmts.empty() ) {
-		return {};
-	} else if ( stmts.size() == 1 ) {
-		const ast::Stmt * callStmt = stmts.front();
-		if ( addCast ) {
-			// implicitly generated ctor/dtor calls should be wrapped so that later passes are
-			// aware they were generated.
-			callStmt = new ast::ImplicitCtorDtorStmt( callStmt->location, callStmt );
-		}
-		return callStmt;
-	} else {
-		assert( false );
-		return {};
-	}
+	if ( stmts.empty() ) return nullptr;
+	assert( stmts.size() == 1 );
+
+	const ast::Stmt * callStmt = stmts.front().release();
+	// Implicitly generated ctor/dtor calls should be wrapped so that
+	// later passes are aware they were generated.
+	if ( addCast ) {
+		callStmt = new ast::ImplicitCtorDtorStmt( callStmt->location, callStmt );
+	}
+	return callStmt;
 }
 
@@ -226,4 +220,2 @@
 // compile-command: "make install" //
 // End: //
-
-
Index: src/SymTab/GenImplicitCall.hpp
===================================================================
--- src/SymTab/GenImplicitCall.hpp	(revision 0522ebe7b3ae7204a1d2c50a1bc7273bfa36762a)
+++ src/SymTab/GenImplicitCall.hpp	(revision d9bad5125c27fa032a8711a3c60c7d6c14d7d39e)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// GenImplicitCall.hpp --
+// GenImplicitCall.hpp -- Generate code for implicit operator calls.
 //
 // Author           : Andrew Beach
@@ -25,5 +25,5 @@
 /// Returns a generated call expression to function fname with srcParam and
 /// dstParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
-ast::ptr<ast::Stmt> genImplicitCall(
+const ast::Stmt * genImplicitCall(
 	InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
 	const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * obj,
