Index: src/SymTab/Autogen.h
===================================================================
--- src/SymTab/Autogen.h	(revision 8404321b14af61fa51a2739f63bc8e76b6c4bed6)
+++ src/SymTab/Autogen.h	(revision 954908d626141a4efd01f89eddf95232bfd6ef42)
@@ -19,4 +19,5 @@
 #include <string>                 // for string
 
+#include "CodeGen/OperatorTable.h"
 #include "Common/UniqueName.h"    // for UniqueName
 #include "InitTweak/InitTweak.h"  // for InitExpander
@@ -60,8 +61,18 @@
 	/// optionally returns a statement which must be inserted prior to the containing loop, if there is one
 	template< typename OutputIterator >
-	Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) {
+	Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression * dstParam, std::string fname, OutputIterator out, Type * type, bool addCast = false ) {
+		bool isReferenceCtorDtor = false;
+		if ( dynamic_cast< ReferenceType * >( type ) && CodeGen::isCtorDtor( fname ) ) {
+			// reference constructors are essentially application of the rebind operator.
+			// apply & to both arguments, do not need a cast
+			fname = "?=?";
+			dstParam = new AddressExpr( dstParam );
+			addCast = false;
+			isReferenceCtorDtor = true;
+		}
+
 		// want to be able to generate assignment, ctor, and dtor generically,
 		// so fname is either ?=?, ?{}, or ^?{}
-		UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );
+		UntypedExpr * fExpr = new UntypedExpr( new NameExpr( fname ) );
 
 		if ( addCast ) {
@@ -78,10 +89,19 @@
 			dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) );
 		}
-		fExpr->get_args().push_back( dstParam );
+		fExpr->args.push_back( dstParam );
 
 		Statement * listInit = srcParam.buildListInit( fExpr );
 
-		std::list< Expression * > args = *++srcParam;
-		fExpr->get_args().splice( fExpr->get_args().end(), args );
+		// fetch next set of arguments
+		++srcParam;
+
+		// return if adding reference fails - will happen on default constructor and destructor
+		if ( isReferenceCtorDtor && ! srcParam.addReference() ) {
+			delete fExpr;
+			return listInit;
+		}
+
+		std::list< Expression * > args = *srcParam;
+		fExpr->args.splice( fExpr->args.end(), args );
 
 		*out++ = new ExprStmt( noLabels, fExpr );
@@ -105,5 +125,5 @@
 			// generate: for ( int i = 0; i < N; ++i )
 			begin = new ConstantExpr( Constant::from_int( 0 ) );
-			end = array->get_dimension()->clone();
+			end = array->dimension->clone();
 			cmp = new NameExpr( "?<?" );
 			update = new NameExpr( "++?" );
@@ -111,6 +131,6 @@
 			// generate: for ( int i = N-1; i >= 0; --i )
 			begin = new UntypedExpr( new NameExpr( "?-?" ) );
-			((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() );
-			((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant::from_int( 1 ) ) );
+			((UntypedExpr*)begin)->args.push_back( array->dimension->clone() );
+			((UntypedExpr*)begin)->args.push_back( new ConstantExpr( Constant::from_int( 1 ) ) );
 			end = new ConstantExpr( Constant::from_int( 0 ) );
 			cmp = new NameExpr( "?>=?" );
@@ -121,29 +141,29 @@
 
 		UntypedExpr *cond = new UntypedExpr( cmp );
-		cond->get_args().push_back( new VariableExpr( index ) );
-		cond->get_args().push_back( end );
+		cond->args.push_back( new VariableExpr( index ) );
+		cond->args.push_back( end );
 
 		UntypedExpr *inc = new UntypedExpr( update );
-		inc->get_args().push_back( new VariableExpr( index ) );
+		inc->args.push_back( new VariableExpr( index ) );
 
 		UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
-		dstIndex->get_args().push_back( dstParam );
-		dstIndex->get_args().push_back( new VariableExpr( index ) );
+		dstIndex->args.push_back( dstParam );
+		dstIndex->args.push_back( new VariableExpr( index ) );
 		dstParam = dstIndex;
 
 		// srcParam must keep track of the array indices to build the
 		// source parameter and/or array list initializer
-		srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() );
+		srcParam.addArrayIndex( new VariableExpr( index ), array->dimension->clone() );
 
 		// for stmt's body, eventually containing call
 		CompoundStmt * body = new CompoundStmt( noLabels );
-		Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward );
+		Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->kids ), array->base, addCast, forward );
 
 		// block containing for stmt and index variable
 		std::list<Statement *> initList;
 		CompoundStmt * block = new CompoundStmt( noLabels );
-		block->get_kids().push_back( new DeclStmt( noLabels, index ) );
+		block->push_back( new DeclStmt( noLabels, index ) );
 		if ( listInit ) block->get_kids().push_back( listInit );
-		block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
+		block->push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
 
 		*out++ = block;
@@ -151,5 +171,5 @@
 
 	template< typename OutputIterator >
-	Statement * genCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) {
+	Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) {
 		if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
 			genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward );
@@ -165,5 +185,5 @@
 	/// ImplicitCtorDtorStmt node.
 	template< typename OutputIterator >
-	void genImplicitCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) {
+	void genImplicitCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) {
 		ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl );
 		assert( obj );
@@ -173,5 +193,5 @@
 		bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && ! obj->get_bitfieldWidth() ) );
 		std::list< Statement * > stmts;
-		genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward );
+		genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->type, addCast, forward );
 
 		// currently genCall should produce at most one element, but if that changes then the next line needs to be updated to grab the statement which contains the call
