Index: src/SymTab/Autogen.cc
===================================================================
--- src/SymTab/Autogen.cc	(revision 1a5ad8ce487f1686045c73a490c9c2c86859213b)
+++ src/SymTab/Autogen.cc	(revision f30b2610e50e4c5af78040998488419804fc2066)
@@ -213,5 +213,5 @@
 
 	bool isUnnamedBitfield( ObjectDecl * obj ) {
-		return obj != nullptr && obj->get_name() == "" && obj->get_bitfieldWidth() != nullptr;
+		return obj != nullptr && obj->name == "" && obj->bitfieldWidth != nullptr;
 	}
 
@@ -219,15 +219,27 @@
 	void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) {
 		FunctionDecl * decl = functionDecl->clone();
-		delete decl->get_statements();
-		decl->set_statements( nullptr );
+		delete decl->statements;
+		decl->statements = nullptr;
 		declsToAdd.push_back( decl );
 		decl->fixUniqueId();
 	}
 
+	const std::list< TypeDecl * > getGenericParams( Type * t ) {
+		std::list< TypeDecl * > * ret = nullptr;
+		if ( StructInstType * inst = dynamic_cast< StructInstType * > ( t ) ) {
+			ret = inst->get_baseParameters();
+		} else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) {
+			ret = inst->get_baseParameters();
+		}
+		return ret ? *ret : std::list< TypeDecl * >();
+	}
+
 	/// given type T, generate type of default ctor/dtor, i.e. function type void (*) (T *)
 	FunctionType * genDefaultType( Type * paramType ) {
+		const auto & typeParams = getGenericParams( paramType );
 		FunctionType *ftype = new FunctionType( Type::Qualifiers(), false );
+		cloneAll( typeParams, ftype->forall );
 		ObjectDecl *dstParam = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), paramType->clone() ), nullptr );
-		ftype->get_parameters().push_back( dstParam );
+		ftype->parameters.push_back( dstParam );
 		return ftype;
 	}
@@ -237,5 +249,5 @@
 		FunctionType *ftype = genDefaultType( paramType );
 		ObjectDecl *srcParam = new ObjectDecl( "_src", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
-		ftype->get_parameters().push_back( srcParam );
+		ftype->parameters.push_back( srcParam );
 		return ftype;
 	}
@@ -245,5 +257,5 @@
 		FunctionType *ftype = genCopyType( paramType );
 		ObjectDecl *returnVal = new ObjectDecl( "_ret", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType->clone(), nullptr );
-		ftype->get_returnVals().push_back( returnVal );
+		ftype->returnVals.push_back( returnVal );
 		return ftype;
 	}
@@ -276,14 +288,4 @@
 	}
 
-	const std::list< TypeDecl * > getGenericParams( Type * t ) {
-		std::list< TypeDecl * > * ret = nullptr;
-		if ( StructInstType * inst = dynamic_cast< StructInstType * > ( t ) ) {
-			ret = inst->get_baseParameters();
-		} else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) {
-			ret = inst->get_baseParameters();
-		}
-		return ret ? *ret : std::list< TypeDecl * >();
-	}
-
 	//=============================================================================================
 	// FuncGenerator member definitions
@@ -318,8 +320,4 @@
 			}
 
-			// Make function polymorphic in same parameters as generic struct, if applicable
-			std::list< TypeDecl * > typeParams = getGenericParams( type ); // List of type variables to be placed on the generated functions
-			cloneAll( typeParams, ftype->forall );
-
 			newFuncs.push_back( genFunc( data.fname, ftype, functionNesting ) );
 		}
@@ -353,5 +351,5 @@
 		// generate appropriate calls to member ctor, assignment
 		// destructor needs to do everything in reverse, so pass "forward" based on whether the function is a destructor
-		if ( ! CodeGen::isDestructor( dcl->get_name() ) ) {
+		if ( ! CodeGen::isDestructor( dcl->name ) ) {
 			makeFunctionBody( aggregateDecl->members.begin(), aggregateDecl->members.end(), dcl );
 		} else {
@@ -362,5 +360,5 @@
 	void StructFuncGenerator::genFieldCtors() {
 		// field ctors are only generated if default constructor and copy constructor are both generated
-		unsigned numCtors = std::count_if( definitions.begin(), definitions.end(), [](Declaration * dcl) { return CodeGen::isConstructor( dcl->get_name() ); } );
+		unsigned numCtors = std::count_if( definitions.begin(), definitions.end(), [](Declaration * dcl) { return CodeGen::isConstructor( dcl->name ); } );
 
 		// Field constructors are only generated if default and copy constructor
@@ -371,7 +369,5 @@
 		// for example, for struct A { int x, y; }; generate
 		//   void ?{}(A *, int) and void ?{}(A *, int, int)
-		const auto & typeParams = aggregateDecl->parameters;
 		FunctionType * memCtorType = genDefaultType( type );
-		cloneAll( typeParams, memCtorType->forall );
 		for ( Declaration * member : aggregateDecl->members ) {
 			DeclarationWithType * field = strict_dynamic_cast<DeclarationWithType *>( member );
@@ -392,6 +388,6 @@
 
 		// assign to destination
-		Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), strict_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
-		genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
+		Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), strict_dynamic_cast< ReferenceType* >( dstParam->get_type() )->base->clone() ) );
+		genImplicitCall( srcParam, dstselect, func->name, back_inserter( func->statements->kids ), field, forward );
 	}
 
@@ -504,7 +500,5 @@
 		// void ?{}(A *, int)
 		// This is to mimic C's behaviour which initializes the first member of the union.
-		const auto & typeParams = aggregateDecl->parameters;
 		FunctionType * memCtorType = genDefaultType( type );
-		cloneAll( typeParams, memCtorType->forall );
 		for ( Declaration * member : aggregateDecl->members ) {
 			DeclarationWithType * field = strict_dynamic_cast<DeclarationWithType *>( member );
