Index: src/Parser/TypeData.cc
===================================================================
--- src/Parser/TypeData.cc	(revision ca1a5475f4eddc0c66780db2fd4589594588899b)
+++ src/Parser/TypeData.cc	(revision fd061ed3078616c91ed6491a7b4ea20a86f06333)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 15:12:51 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Feb 23 16:26:39 2017
-// Update Count     : 477
+// Last Modified On : Thu Feb 23 21:48:55 2017
+// Update Count     : 485
 //
 
@@ -62,4 +62,5 @@
 		aggInst.aggregate = nullptr;
 		aggInst.params = nullptr;
+		aggInst.hoistType = false;;
 		break;
 	  case Enum:
@@ -195,4 +196,5 @@
 		newtype->aggInst.aggregate = maybeClone( aggInst.aggregate );
 		newtype->aggInst.params = maybeClone( aggInst.params );
+		newtype->aggInst.hoistType = aggInst.hoistType;
 		break;
 	  case Enum:
@@ -644,27 +646,85 @@
 } // buildAggregate
 
+ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {
+	switch ( type->kind ) {
+	  case TypeData::Enum: {
+		  if ( type->enumeration.body ) {
+			  EnumDecl * typedecl = buildEnum( type, attributes );
+			  return new EnumInstType( buildQualifiers( type ), typedecl );
+		  } else {
+			  return new EnumInstType( buildQualifiers( type ), *type->enumeration.name );
+		  } // if
+	  }
+	  case TypeData::Aggregate: {
+		  ReferenceToType * ret;
+		  if ( type->aggregate.body ) {
+			  AggregateDecl * typedecl = buildAggregate( type, attributes );
+			  switch ( type->aggregate.kind ) {
+				case DeclarationNode::Struct:
+				  ret = new StructInstType( buildQualifiers( type ), (StructDecl *)typedecl );
+				  break;
+				case DeclarationNode::Union:
+				  ret = new UnionInstType( buildQualifiers( type ), (UnionDecl *)typedecl );
+				  break;
+				case DeclarationNode::Trait:
+				  assert( false );
+				  //ret = new TraitInstType( buildQualifiers( type ), (TraitDecl *)typedecl );
+				  break;
+				default:
+				  assert( false );
+			  } // switch
+		  } else {
+			  switch ( type->aggregate.kind ) {
+				case DeclarationNode::Struct:
+				  ret = new StructInstType( buildQualifiers( type ), *type->aggregate.name );
+				  break;
+				case DeclarationNode::Union:
+				  ret = new UnionInstType( buildQualifiers( type ), *type->aggregate.name );
+				  break;
+				case DeclarationNode::Trait:
+				  ret = new TraitInstType( buildQualifiers( type ), *type->aggregate.name );
+				  break;
+				default:
+				  assert( false );
+			  } // switch
+		  } // if
+		  return ret;
+	  }
+	  default:
+		assert( false );
+	} // switch
+} // buildAggInst
+
 ReferenceToType * buildAggInst( const TypeData * td ) {
 	assert( td->kind == TypeData::AggregateInst );
 
-	ReferenceToType * ret;
-	if ( td->aggInst.aggregate->kind == TypeData::Enum ) {
-		ret = new EnumInstType( buildQualifiers( td ), *td->aggInst.aggregate->enumeration.name );
-	} else {
-		assert( td->aggInst.aggregate->kind == TypeData::Aggregate );
-		switch ( td->aggInst.aggregate->aggregate.kind ) {
-		  case DeclarationNode::Struct:
-			assert( td->aggInst.aggregate->aggregate.name );
-			ret = new StructInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
-			break;
-		  case DeclarationNode::Union:
-			ret = new UnionInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
-			break;
-		  case DeclarationNode::Trait:
-			ret = new TraitInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name );
-			break;
-		  default:
-			assert( false );
-		} // switch
-	} // if
+	// ReferenceToType * ret = buildComAggInst( td->aggInst.aggregate, std::list< Attribute * >() );
+	ReferenceToType * ret = nullptr;
+	TypeData * type = td->aggInst.aggregate;
+	switch ( type->kind ) {
+	  case TypeData::Enum: {
+		  return new EnumInstType( buildQualifiers( type ), *type->enumeration.name );
+	  }
+	  case TypeData::Aggregate: {
+		  switch ( type->aggregate.kind ) {
+			case DeclarationNode::Struct:
+			  ret = new StructInstType( buildQualifiers( type ), *type->aggregate.name );
+			  break;
+			case DeclarationNode::Union:
+			  ret = new UnionInstType( buildQualifiers( type ), *type->aggregate.name );
+			  break;
+			case DeclarationNode::Trait:
+			  ret = new TraitInstType( buildQualifiers( type ), *type->aggregate.name );
+			  break;
+			default:
+			  assert( false );
+		  } // switch
+	  }
+	  break;
+	  default:
+		assert( false );
+	} // switch
+
+	ret->set_hoistType( td->aggInst.hoistType );
 	buildList( td->aggInst.params, ret->get_parameters() );
 	buildForall( td->forall, ret->get_forall() );
