--- old/usr/src/lib/libdtrace/common/dt_parser.c	2015-04-17 12:29:28.098918987 -0400
+++ new/usr/src/lib/libdtrace/common/dt_parser.c	2015-04-17 12:29:28.111774151 -0400
@@ -1369,7 +1369,8 @@
 	dnp->dn_op = DT_TOK_IDENT;
 	dnp->dn_string = name;
 
-	dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, dtt.dtt_flags);
+	dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type,
+	    dtt.dtt_flags & DTT_FL_USER ? B_TRUE : B_FALSE);
 
 	if (dtt.dtt_ctfp == dtp->dt_cdefs->dm_ctfp ||
 	    dtt.dtt_ctfp == dtp->dt_ddefs->dm_ctfp)
@@ -1798,6 +1799,7 @@
 
 	ctf_membinfo_t ctm;
 	ctf_id_t type;
+	ctf_file_t *ctfp;
 	uint_t kind;
 
 	name = strdupa(s);
@@ -1823,7 +1825,15 @@
 	}
 
 	bzero(&dn, sizeof (dn));
-	dt_node_type_assign(&dn, dtt.dtt_ctfp, ctm.ctm_type, B_FALSE);
+	/*
+	 * Resolution of CTF_K_FORWARD is unnecessary here, since it can't be
+	 * both forward _and_ a bitfield, but is done for completeness.
+	 */
+	type = ctm.ctm_type;
+	ctfp = dtt.dtt_ctfp;
+
+	dt_resolve_forward_decl(&ctfp, &type);
+	dt_node_type_assign(&dn, ctfp, type, B_FALSE);
 
 	if (dn.dn_flags & DT_NF_BITFIELD) {
 		xyerror(D_OFFSETOF_BITFIELD,
@@ -2423,7 +2433,7 @@
 
 	if (ddp != NULL)
 		dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type,
-		    dtt.dtt_flags);
+		    dtt.dtt_flags & DTT_FL_USER ? B_TRUE : B_FALSE);
 
 	return (dnp);
 }
@@ -2780,7 +2790,7 @@
 		dnp->dn_flags |= DT_NF_LVALUE;
 
 		dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type,
-		    dtt.dtt_flags);
+		    dtt.dtt_flags & DTT_FL_USER ? B_TRUE : B_FALSE);
 		dt_node_attr_assign(dnp, _dtrace_symattr);
 
 		if (uref) {
@@ -2932,7 +2942,7 @@
 
 		dt_ident_type_assign(cp->dn_ident, dtt.dtt_ctfp, dtt.dtt_type);
 		dt_node_type_assign(cp, dtt.dtt_ctfp, dtt.dtt_type,
-		    dtt.dtt_flags);
+		    dtt.dtt_flags & DTT_FL_USER ? B_TRUE : B_FALSE);
 	}
 
 	if (cp->dn_kind == DT_NODE_VAR)
@@ -3725,24 +3735,16 @@
 		 * If we follow a reference to a forward declaration tag,
 		 * search the entire type space for the actual definition.
 		 */
-		while (kind == CTF_K_FORWARD) {
-			char *tag = ctf_type_name(ctfp, type, n1, sizeof (n1));
-			dtrace_typeinfo_t dtt;
-
-			if (tag != NULL && dt_type_lookup(tag, &dtt) == 0 &&
-			    (dtt.dtt_ctfp != ctfp || dtt.dtt_type != type)) {
-				ctfp = dtt.dtt_ctfp;
-				type = ctf_type_resolve(ctfp, dtt.dtt_type);
-				kind = ctf_type_kind(ctfp, type);
-			} else {
-				xyerror(D_OP_INCOMPLETE,
-				    "operator %s cannot be applied to a "
-				    "forward declaration: no %s definition "
-				    "is available\n", opstr(op), tag);
-			}
-		}
+		dt_resolve_forward_decl(&ctfp, &type);
+		kind = ctf_type_kind(ctfp, type);
 
-		if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) {
+		if (kind == CTF_K_FORWARD) {
+			xyerror(D_OP_INCOMPLETE,
+			    "operator %s cannot be applied to a "
+			    "forward declaration: no %s definition "
+			    "is available\n", opstr(op),
+			    ctf_type_name(ctfp, type, n1, sizeof (n1)));
+		} else if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) {
 			if (op == DT_TOK_PTR) {
 				xyerror(D_OP_SOU, "operator -> cannot be "
 				    "applied to pointer to type \"%s\"; must "
@@ -3762,12 +3764,15 @@
 			    ctf_type_name(ctfp, type, n1, sizeof (n1)));
 		}
 
-		type = ctf_type_resolve(ctfp, m.ctm_type);
-		kind = ctf_type_kind(ctfp, type);
+		type = m.ctm_type;
 
-		dt_node_type_assign(dnp, ctfp, m.ctm_type, B_FALSE);
+		dt_resolve_forward_decl(&ctfp, &type);
+		dt_node_type_assign(dnp, ctfp, type, B_FALSE);
 		dt_node_attr_assign(dnp, lp->dn_attr);
 
+		type = ctf_type_resolve(ctfp, type);
+		kind = ctf_type_kind(ctfp, type);
+
 		if (op == DT_TOK_PTR && (kind != CTF_K_ARRAY ||
 		    dt_node_is_string(dnp)))
 			dnp->dn_flags |= DT_NF_LVALUE; /* see K&R[A7.3.3] */
@@ -4275,6 +4280,8 @@
 
 	dtrace_attribute_t attr = _dtrace_maxattr;
 	ctf_membinfo_t ctm;
+	ctf_id_t type;
+	ctf_file_t *ctfp;
 
 	/*
 	 * Before cooking each translator member, we push a reference to the
@@ -4293,7 +4300,16 @@
 		}
 
 		(void) dt_node_cook(mnp, DT_IDFLG_REF);
-		dt_node_type_assign(mnp, dxp->dx_dst_ctfp, ctm.ctm_type,
+		ctfp = dxp->dx_dst_ctfp;
+		type = ctm.ctm_type;
+
+		/*
+		 *
+		 * This probably doesn't need to be resolved, because it's of
+		 * the translator, but is done for completeness right now.
+		 */
+		dt_resolve_forward_decl(&ctfp, &type);
+		dt_node_type_assign(mnp, ctfp, type,
 		    B_FALSE);
 		attr = dt_attr_min(attr, mnp->dn_attr);
 
