Hello,<br><br><div>This patch isn't quite right, consider the following:</div><div><br></div><div>struct BaseWithFlexible { int a[]; };</div><div>struct NotSoEmptyBase { int b; };</div><div>struct Derived : BaseWithFlexible, NotSoEmptyBase { };</div>
<div><br></div><div>In this example, 'Derived' has no fields but the flexible array member still interferes with 'NotSoEmptyBase'</div><div><br></div><div>another test case:</div><div><div>struct BaseWithFlexible { int a[]; };</div>
</div><div>struct Derived : virtual BaseWithFlexible { };</div><div><br></div><div>In this case, the flexible array member would index into the v-table/vb-table pointer of 'Derived'.<br></div><div><br></div><div>final test case:</div>
<div>struct BaseWithFlexible { int a[]; };</div><div>struct Derived : BaseWithFlexible { virtual ~Derived() {} };</div><div><br></div><div>For this final case, the flexible array member would index into the v-table/vf-table of 'Derived'.</div>
<div><br></div><div>-- </div><div>David Majnemer</div><div><br></div><div>On Fri Feb 21 2014 at 10:47:39 PM, Curtis Dunham <<a href="mailto:curtis.dunham@gmail.com" target="_blank">curtis.dunham@gmail.com</a>> wrote:</div>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div>Please consider for review this patch.</div><div><br></div><div>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.</div>


<div><br></div><div>thanks,</div><div>Curtis Dunham</div></div>
______________________________<u></u><u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailm<u></u>an/listinfo/cfe-commits</a><br>
</blockquote>