commit 7b78308a67c7abbe8ae4d2011ef1452610cff911
Author: Andreas Brauchli <a.brauchli@elementarea.net>
Date:   Fri Jan 16 16:18:30 2009 +0100

    also recurse on the initializer list fields

diff --git a/gobject/valaccodebasemodule.vala b/gobject/valaccodebasemodule.vala
index 5766d9e..fc77b43 100644
--- a/gobject/valaccodebasemodule.vala
+++ b/gobject/valaccodebasemodule.vala
@@ -2964,7 +2964,24 @@ public class Vala.CCodeBaseModule : CCodeModule {
 					var typed_inst = transform_expression (instance, expr.type_reference, instance_target_type);
 					CCodeExpression lhs;
 					if (expr.type_reference.data_type is Struct) {
-						lhs = new CCodeMemberAccess (typed_inst, f.get_cname ());
+						if (st.base_struct == null || f in st.get_fields ()) {
+							lhs = new CCodeMemberAccess (typed_inst, f.get_cname ());
+						} else {
+						   // recurse through the parents of a struct to access the desired field
+						   lhs = null;
+						   var parent_struct = st.base_struct;
+						   var parent_struct_access = new CCodeMemberAccess (typed_inst, "parent_struct");
+
+						   while (parent_struct != null) {
+							   if (f in parent_struct.get_fields ()) {
+								   lhs = new CCodeMemberAccess (parent_struct_access, f.get_cname ());
+								   break;
+							   }
+							   parent_struct = parent_struct.base_struct;
+							   parent_struct_access = new CCodeMemberAccess (parent_struct_access, "parent_struct");
+						   }
+						   assert (lhs != null);
+						}
 					} else {
 						lhs = new CCodeMemberAccess.pointer (typed_inst, f.get_cname ());
 					}
