On 03/10/2011 11:14 AM, Dodji Seketeli wrote:
+         /* If we are initializing a sub-object of
+            CURRENT_OBJECT_TYPE [for which a primary base class
+            sub-object has already been initialized] then we must NOT
+            initialize any sub-object from a virtual base that is a
+            direct or indirect primary base of
+            CURRENT_OBJECT_TYPE.  */
+         if (current_object_type
+             && is_virtual_base_of (TREE_TYPE (field), current_object_type)
+             && is_primary_base_of (TREE_TYPE (field), current_object_type,
+                                    /*indirect_p=*/true))
+           continue;

This seems like the wrong test. If we're currently initializing a subobject, then we don't want to initialize any of our virtual base fields unless they are primary to the current type. We don't need to consider the complete object type at all.

I'm also rather nervous about using is_*_base_of tests given that a class can have multiple indirect bases of a particular type. Whether or not there is a virtual base T of U isn't important; what is important is whether the current field represents a virtual base.

Jason

Reply via email to