Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision 2a6292d096f75213cc1215a8e87df6c11a6e15a7)
+++ src/SymTab/Validate.cc	(revision 031a88a9185c8893c2e6d735d2cd99e596118b4e)
@@ -403,24 +403,5 @@
 			assert( aggr ); // TODO: need to handle forward declarations
 			for ( Declaration * member : aggr->members ) {
-				if ( StructInstType * inst = dynamic_cast< StructInstType * >( child ) ) {
-					if ( StructDecl * aggr = dynamic_cast< StructDecl * >( member ) ) {
-						if ( aggr->name == inst->name ) {
-							// TODO: is this case, and other non-TypeInstType cases, necessary?
-							return new StructInstType( qualType->get_qualifiers(), aggr );
-						}
-					}
-				} else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( child ) ) {
-					if ( UnionDecl * aggr = dynamic_cast< UnionDecl * > ( member ) ) {
-						if ( aggr->name == inst->name ) {
-							return new UnionInstType( qualType->get_qualifiers(), aggr );
-						}
-					}
-				} else if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( child ) ) {
-					if ( EnumDecl * aggr = dynamic_cast< EnumDecl * > ( member ) ) {
-						if ( aggr->name == inst->name ) {
-							return new EnumInstType( qualType->get_qualifiers(), aggr );
-						}
-					}
-				} else if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) {
+				if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( child ) ) {
 					// name on the right is a typedef
 					if ( NamedTypeDecl * aggr = dynamic_cast< NamedTypeDecl * > ( member ) ) {
@@ -429,4 +410,6 @@
 							Type * ret = aggr->base->clone();
 							ret->get_qualifiers() = qualType->get_qualifiers();
+							TypeSubstitution sub = parent->genericSubstitution();
+							sub.apply(ret);
 							return ret;
 						}
