Hello,

This patch isn't quite right, consider the following:

struct BaseWithFlexible { int a[]; };
struct NotSoEmptyBase { int b; };
struct Derived : BaseWithFlexible, NotSoEmptyBase { };

In this example, 'Derived' has no fields but the flexible array member
still interferes with 'NotSoEmptyBase'

another test case:
struct BaseWithFlexible { int a[]; };
struct Derived : virtual BaseWithFlexible { };

In this case, the flexible array member would index into the
v-table/vb-table pointer of 'Derived'.

final test case:
struct BaseWithFlexible { int a[]; };
struct Derived : BaseWithFlexible { virtual ~Derived() {} };

For this final case, the flexible array member would index into the
v-table/vf-table of 'Derived'.

-- 
David Majnemer

On Fri Feb 21 2014 at 10:47:39 PM, Curtis Dunham <[email protected]>
wrote:

Hi all,
Please consider for review this patch.

If a class deriving from an base class with a flexible array has no new
data members of its own, the issue of the data member offset never comes
into play.  I have a large, mature codebase that tripped over this recently
added, but slightly overzealous, semantic check.

thanks,
Curtis Dunham
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to