[cfe-commits] PR12204 PATCH: static_cast to Base class overrides the Derived class field.
rjmccall at apple.com
Tue Mar 27 12:05:49 PDT 2012
I think this patch is the wrong approach. Instead, EmitAggregateCopy should be modified so that it always copies structs using their data size if either the source or the destination might be a base-class subobject. There is no need to adjust the alignment.
We should conservatively assume that an object might be a base-class subobject if this is C++ and the class is not marked final. This is probably going to hurt the performance of generated code in some cases, and we should add a flag indicating that both objects are known to not be base-class subobjects. This flag should default to false.
If you wouldn't mind writing up a new patch based on this approach, I'll save the code-style comments for that.
More information about the cfe-commits