Index: src/ResolvExpr/SpecCost.cc
===================================================================
--- src/ResolvExpr/SpecCost.cc	(revision 4fc3343d30eedad8ba6af81defc9b7c688e040d3)
+++ src/ResolvExpr/SpecCost.cc	(revision 978e5eb2a935600a493cda570c9293584824c675)
@@ -43,4 +43,7 @@
 		// mark specialization of base type
 		void postvisit(ReferenceType*) { if ( count >= 0 ) ++count; }
+
+		void postvisit(StructInstType*) { if ( count >= 0 ) ++count; }
+		void postvisit(UnionInstType*) { if ( count >= 0 ) ++count; }
 
 	private:
@@ -82,5 +85,4 @@
 		void previsit(StructInstType* sty) {
 			count = minover( sty->parameters );
-			visit_children = false;
 		}
 
@@ -88,5 +90,4 @@
 		void previsit(UnionInstType* uty) {
 			count = minover( uty->parameters );
-			visit_children = false;
 		}
 
@@ -174,4 +175,7 @@
 		void postvisit( const ast::ArrayType * ) { if ( count >= 0 ) ++count; }
 		void postvisit( const ast::ReferenceType * ) { if ( count >= 0 ) ++count; }
+
+		void postvisit( const ast::StructInstType * ) { if ( count >= 0 ) ++count; }
+		void postvisit( const ast::UnionInstType * ) { if ( count >= 0 ) ++count; }
 
 		// Use the minimal specialization value over returns and params.
@@ -189,5 +193,4 @@
 		void previsit( const ast::StructInstType * sty ) {
 			count = minimumPresent( sty->params, expr_result );
-			visit_children = false;
 		}
 
@@ -195,5 +198,4 @@
 		void previsit( const ast::UnionInstType * uty ) {
 			count = minimumPresent( uty->params, expr_result );
-			visit_children = false;
 		}
 
Index: tests/.expect/poly-selection.txt
===================================================================
--- tests/.expect/poly-selection.txt	(revision 978e5eb2a935600a493cda570c9293584824c675)
+++ tests/.expect/poly-selection.txt	(revision 978e5eb2a935600a493cda570c9293584824c675)
@@ -0,0 +1,2 @@
+friending generically
+friending specifically
Index: tests/poly-selection.cfa
===================================================================
--- tests/poly-selection.cfa	(revision 978e5eb2a935600a493cda570c9293584824c675)
+++ tests/poly-selection.cfa	(revision 978e5eb2a935600a493cda570c9293584824c675)
@@ -0,0 +1,40 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// poly-selection.cfa -- tests that show correct candidates selected, given interesting cases of
+//                       forall/overload polymoprphism
+//
+// Author           : Michael Brooks
+// Created On       : Mon Jan 18 15:00:00 2021
+// Last Modified By : Michael Brooks
+// Last Modified On : Mon Jan 18 15:00:00 2021
+// Update Count     : 1
+//
+
+void testSpecializationFromGenericOverBareTyvar() {
+    forall( dtype T )
+    void friend( T & ) {
+        printf("friending generically\n");
+    }
+
+    forall(dtype T)
+    struct thing {
+        int x;
+    };
+
+    forall( dtype T )
+    void friend( thing(T) & ) {
+        printf("friending specifically\n");
+    }
+
+    float x;           friend( x );
+    thing(float) y;    friend( y );
+}
+
+
+int main() {
+    testSpecializationFromGenericOverBareTyvar();
+}
