Index: src/Validate/Autogen.cpp
===================================================================
--- src/Validate/Autogen.cpp	(revision 0b0a285cb86eb63d47d96868ae2d0f99f753448c)
+++ src/Validate/Autogen.cpp	(revision c84dd616ea09c9d1bd0ef0c0fba904ff70c4d83d)
@@ -321,4 +321,5 @@
 void FuncGenerator::produceDecl( const ast::FunctionDecl * decl ) {
 	assert( nullptr != decl->stmts );
+	assert( decl->type_params.size() == getGenericParams( type ).size() );
 
 	definitions.push_back( decl );
@@ -356,5 +357,5 @@
 		decl->init = nullptr;
 		splice( assertions, decl->assertions );
-		oldToNew.emplace( std::make_pair( old_param, decl ) );
+		oldToNew.emplace( old_param, decl );
 		type_params.push_back( decl );
 	}
@@ -522,5 +523,5 @@
 	InitTweak::InitExpander_new srcParam( src );
 	// Assign to destination.
-	ast::Expr * dstSelect = new ast::MemberExpr(
+	ast::MemberExpr * dstSelect = new ast::MemberExpr(
 		location,
 		field,
@@ -574,5 +575,5 @@
 		}
 
-		ast::Expr * srcSelect = (srcParam) ? new ast::MemberExpr(
+		ast::MemberExpr * srcSelect = (srcParam) ? new ast::MemberExpr(
 			location, field, new ast::VariableExpr( location, srcParam )
 		) : nullptr;
Index: src/Validate/GenericParameter.cpp
===================================================================
--- src/Validate/GenericParameter.cpp	(revision 0b0a285cb86eb63d47d96868ae2d0f99f753448c)
+++ src/Validate/GenericParameter.cpp	(revision c84dd616ea09c9d1bd0ef0c0fba904ff70c4d83d)
@@ -120,5 +120,14 @@
 }
 
-struct ValidateGenericParamsCore : public ast::WithCodeLocation {
+bool isSizedPolymorphic( const ast::AggregateDecl * decl ) {
+	for ( const auto & param : decl->params ) {
+		if ( param->sized ) return true;
+	}
+	return false;
+}
+
+struct ValidateGenericParamsCore :
+		public ast::WithCodeLocation, public ast::WithGuards {
+	// Generic parameter filling and checks:
 	const ast::StructInstType * previsit( const ast::StructInstType * type ) {
 		assert( location );
@@ -129,4 +138,25 @@
 		assert( location );
 		return validateGeneric( *location, type );
+	}
+
+	// Check parameter and bitfield combinations:
+	bool insideSized = false;
+	void previsit( const ast::StructDecl * decl ) {
+		if ( isSizedPolymorphic( decl ) && !insideSized ) {
+			GuardValue( insideSized ) = true;
+		}
+	}
+
+	void previsit( const ast::UnionDecl * decl ) {
+		if ( isSizedPolymorphic( decl ) && !insideSized ) {
+			GuardValue( insideSized ) = true;
+		}
+	}
+
+	void previsit( const ast::ObjectDecl * decl ) {
+		if ( insideSized && decl->bitfieldWidth ) {
+			SemanticError( decl->location, decl,
+				"Cannot have bitfields inside a sized polymorphic structure." );
+		}
 	}
 };
Index: src/Validate/LinkReferenceToTypes.cpp
===================================================================
--- src/Validate/LinkReferenceToTypes.cpp	(revision 0b0a285cb86eb63d47d96868ae2d0f99f753448c)
+++ src/Validate/LinkReferenceToTypes.cpp	(revision c84dd616ea09c9d1bd0ef0c0fba904ff70c4d83d)
@@ -84,5 +84,5 @@
 		// Just linking in the node.
 		auto mut = ast::mutate( type );
-		mut->base = const_cast<ast::EnumDecl *>( decl );
+		mut->base = decl;
 		type = mut;
 	}
@@ -101,5 +101,5 @@
 		// Just linking in the node.
 		auto mut = ast::mutate( type );
-		mut->base = const_cast<ast::StructDecl *>( decl );
+		mut->base = decl;
 		type = mut;
 	}
@@ -118,5 +118,5 @@
 		// Just linking in the node.
 		auto mut = ast::mutate( type );
-		mut->base = const_cast<ast::UnionDecl *>( decl );
+		mut->base = decl;
 		type = mut;
 	}
@@ -141,5 +141,5 @@
 
 	// Just linking in the node.
-	mut->base = const_cast<ast::TraitDecl *>( decl );
+	mut->base = decl;
 
 	// Need to carry over the 'sized' status of each decl in the instance.
@@ -203,6 +203,4 @@
 	}
 
-	// The following section 
-
 	ForwardEnumsType::iterator fwds = forwardEnums.find( decl->name );
 	if ( fwds != forwardEnums.end() ) {
