<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 18, 2008, at 4:44 PM, Neil Booth wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Steve Naroff wrote:-<br><br><blockquote type="cite">+struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}<br></blockquote><br>Why do you think there is something inherently wrong with this? In<br>general you have to wait until the end of the TU.<br><br></blockquote><div><br class="webkit-block-placeholder"></div>You are correct.</div><div><br class="webkit-block-placeholder"></div><div><div>To properly diagnose this, clang needs to check for incomplete types at the end of the translation unit.</div><div><br class="webkit-block-placeholder"></div></div><div>I remember putting the following FIXME in SemaDecl.cpp:</div><div><br class="webkit-block-placeholder"></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); ">/// FIXME: Need to carefully consider tentative definition rules (C99 6.9.2p2).</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); ">/// For example, we incorrectly complain about i1, i4 from C99 6.9.2p4.</div>
</div><div><br></div><div>This requires a bit more API fiddling. For example, we need a ActOnEndTranslationUnit action, etc.</div><div><br></div><div>In fact, when I added the FIXME above, clang didn't even have the notion of a TranslationUnit:-)</div><div><br></div><div>snaroff</div><div><br><blockquote type="cite">struct foo x;<br>struct foo { int x; };<br><br>does not violate any rule in the standard I'm aware of, so must be<br>accepted.<br><br>/tmp/bug.c:1:12: error: variable has incomplete type 'struct foo'<br>struct foo x;<br> ^<br>1 diagnostic generated.<br><br>Neil.<br></blockquote></div><br></body></html>