<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">On Sep 22, 2017, at 01:06, David Chisnall <<a href="mailto:David.Chisnall@cl.cam.ac.uk" class="">David.Chisnall@cl.cam.ac.uk</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class="">On 22 Sep 2017, at 06:31, John McCall <<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>> wrote:<br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">Thanks everybody for their input. I plan to update the patch with different test cases so it's easier to discuss. But so far my summary is the following.<br class=""><br class="">For flexible array members we allow them only as the last ivar in @interface, with no ivars in @implementation. If it's not last, if it is in @implementation, if there are more ivars in @implementation - that's an error.<br class=""><br class="">For variable sized types (i.e. structs with last member a flexible array) we don't error but warn if we can detect more ivars after it (in @interface or in @implementation). If @implementation ivars end with variable sized ivar, no error or warning.<br class=""><br class="">For subclassing we don't error but warn if we can detect more ivars after a flexible array member or after a variable sized type member.<br class=""></blockquote><br class="">I think most of this sounds reasonable. I would recommend being lax about whether the ivar is declared in the @interface vs. the @implementation, though.<br class=""></blockquote><br class="">If nothing else, I’d recommend a warning if the ivar is in the @implementation, because that means that we can’t guarantee getting a warning for subclasses, but apart from that this looks like a sensible design. Thanks!<br class=""><br class="">David<br class=""></div></div></blockquote><br class=""></div><div>Added test cases to <a href="https://reviews.llvm.org/D38114" class="">https://reviews.llvm.org/D38114</a> Changes from my previous proposal:</div><div>* Allow flexible array members and variable sized types in @implementation but it should be the last field. And there is still a warning in this case.</div><div>* Error when variable sized type is not the last field (StructNotLastIVar, StructOtherIVarInImpl, StructNotLastIVarInImpl). Currently for C clang shows a warning that’s a GNU extension but by default GCC 7.2 rejects such code so I’m not sure it is worth supporting this extension for Objective-C.</div><div><br class=""></div><div>Volodymyr</div></body></html>