<div dir="ltr">On Tue, Sep 10, 2013 at 2:03 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Currently, if you have a value assignment involving structures<br>
containing a flexible array, no diagnostic is emitted. However, since<br>
the array members won't be copied as part of the assignment, a<br>
diagnostic will help programmers avoid bugs. This patch emits said<br>
diagnostic.<br><br></blockquote><div><br></div><div>+def warn_flexible_array_assignment : ExtWarn<</div><div>+ "assignment of flexible arrays does not copy the array members">,</div><div>+ InGroup<FlexibleArrayExtensions>;</div>
<div><br></div><div>I assume this is supposed to be a Warning, not an ExtWarn?</div><div><br></div><div>Also, I'm not sure putting this into the FlexibleArrayExtensions diagnostic group is the best idea.</div><div><br>
</div><div>What sort of mistakes do you expect this to catch in practice?</div><div><br></div><div>Have you considered warning about the variable declaration rather than the assignment? In your testcase, it's impossible to call foo() without triggering the warning, so it seems better to warn about foo() itself rather than the call.</div>
<div><br></div><div>-Eli</div></div></div></div>