Index: src/SymTab/Autogen.cc
===================================================================
--- src/SymTab/Autogen.cc	(revision 6926a6d7f7d25248636a86659e105cdffdbb320e)
+++ src/SymTab/Autogen.cc	(revision ff29f0885c5ef43cc494cdb91326ef1813825a32)
@@ -214,5 +214,4 @@
 	void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) {
 		FunctionDecl * decl = functionDecl->clone();
-		delete decl->statements;
 		decl->statements = nullptr;
 		declsToAdd.push_back( decl );
@@ -333,5 +332,4 @@
 		} catch ( SemanticErrorException & ) {
 			// okay if decl does not resolve - that means the function should not be generated
-			delete dcl;
 		}
 	}
@@ -373,5 +371,4 @@
 			// do not carry over field's attributes to parameter type
 			Type * paramType = field->get_type()->clone();
-			deleteAll( paramType->attributes );
 			paramType->attributes.clear();
 			// add a parameter corresponding to this field
@@ -383,5 +380,4 @@
 			resolve( ctor );
 		}
-		delete memCtorType;
 	}
 
@@ -511,5 +507,4 @@
 			// do not carry over field's attributes to parameter type
 			Type * paramType = field->get_type()->clone();
-			deleteAll( paramType->attributes );
 			paramType->attributes.clear();
 			// add a parameter corresponding to this field
@@ -524,5 +519,4 @@
 			break;
 		}
-		delete memCtorType;
 	}
 
@@ -594,7 +588,7 @@
 		// must visit children (enum constants) to add them to the indexer
 		if ( enumDecl->has_body() ) {
-			EnumInstType enumInst( Type::Qualifiers(), enumDecl->get_name() );
-			enumInst.set_baseEnum( enumDecl );
-			EnumFuncGenerator gen( &enumInst, data, functionNesting, indexer );
+			auto enumInst = new EnumInstType{ Type::Qualifiers(), enumDecl->get_name() };
+			enumInst->set_baseEnum( enumDecl );
+			EnumFuncGenerator gen( enumInst, data, functionNesting, indexer );
 			generateFunctions( gen, declsToAddAfter );
 		}
@@ -604,10 +598,10 @@
 		visit_children = false;
 		if ( structDecl->has_body() ) {
-			StructInstType structInst( Type::Qualifiers(), structDecl->name );
-			structInst.set_baseStruct( structDecl );
+			auto structInst = new StructInstType{ Type::Qualifiers(), structDecl->name };
+			structInst->set_baseStruct( structDecl );
 			for ( TypeDecl * typeDecl : structDecl->parameters ) {
-				structInst.parameters.push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->name, typeDecl ) ) );
-			}
-			StructFuncGenerator gen( structDecl, &structInst, data, functionNesting, indexer );
+				structInst->parameters.push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->name, typeDecl ) ) );
+			}
+			StructFuncGenerator gen( structDecl, structInst, data, functionNesting, indexer );
 			generateFunctions( gen, declsToAddAfter );
 		} // if
@@ -617,10 +611,10 @@
 		visit_children = false;
 		if ( unionDecl->has_body()  ) {
-			UnionInstType unionInst( Type::Qualifiers(), unionDecl->get_name() );
-			unionInst.set_baseUnion( unionDecl );
+			auto unionInst = new UnionInstType{ Type::Qualifiers(), unionDecl->get_name() };
+			unionInst->set_baseUnion( unionDecl );
 			for ( TypeDecl * typeDecl : unionDecl->get_parameters() ) {
-				unionInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );
-			}
-			UnionFuncGenerator gen( unionDecl, &unionInst, data, functionNesting, indexer );
+				unionInst->get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );
+			}
+			UnionFuncGenerator gen( unionDecl, unionInst, data, functionNesting, indexer );
 			generateFunctions( gen, declsToAddAfter );
 		} // if
@@ -631,6 +625,6 @@
 		if ( ! typeDecl->base ) return;
 
-		TypeInstType refType( Type::Qualifiers(), typeDecl->name, typeDecl );
-		TypeFuncGenerator gen( typeDecl, &refType, data, functionNesting, indexer );
+		auto refType = new TypeInstType{ Type::Qualifiers(), typeDecl->name, typeDecl };
+		TypeFuncGenerator gen( typeDecl, refType, data, functionNesting, indexer );
 		generateFunctions( gen, declsToAddAfter );
 
