Index: src/SymTab/Autogen.cc
===================================================================
--- src/SymTab/Autogen.cc	(revision 5fda7143cbcbc2c8f66e8862aecc99dfa3619c54)
+++ src/SymTab/Autogen.cc	(revision 4e7f0f12366b17b64027e4a7f35e202a91eb6c12)
@@ -280,4 +280,12 @@
 	}
 
+	void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) {
+		FunctionDecl * decl = functionDecl->clone();
+		delete decl->get_statements();
+		decl->set_statements( NULL );
+		declsToAdd.push_back( decl );
+		decl->fixUniqueId();
+	}
+
 	void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd ) {
 		FunctionType *assignType = new FunctionType( Type::Qualifiers(), false );
@@ -324,4 +332,13 @@
 		copyCtorDecl->fixUniqueId();
 		dtorDecl->fixUniqueId();
+
+		if ( functionNesting == 0 ) {
+			// forward declare if top-level struct, so that
+			// type is complete as soon as its body ends
+			addForwardDecl( assignDecl, declsToAdd );
+			addForwardDecl( ctorDecl, declsToAdd );
+			addForwardDecl( copyCtorDecl, declsToAdd );
+			addForwardDecl( dtorDecl, declsToAdd );
+		}
 
 		// create constructors which take each member type as a parameter.
