<div dir="ltr">Hi Richard,<br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">2015-04-06 6:16 GMT+06:00 Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span>:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Please add a testcase that uses a forward declaration and then defines it, such as:<br>
<span class=""><br>
  template<typename T> void f() {<br>
    void g(struct x);<br>
</span>    struct x {};<br>
<span class="">  }<br>
  template void f<int>();<br>
<br>
</span>I think a case like that will still assert with your current patch (because `x` is not an incomplete type, but it won't have had a declaration instantiated when we instantiate the declaration of `g`).<br>
<br></blockquote><div><br></div><div>Yes, you are right, this case was not handled. Added instantiation of the type for which we see forward declaration.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
================<br>
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:2802<br>
@@ +2801,3 @@<br>
+  if (const TagDecl *TD = dyn_cast<TagDecl>(D))<br>
<span class="">+    if (TD->getTypeForDecl()->isIncompleteType())<br>
+      return nullptr;<br>
</span>----------------<br>
This should use the same condition as the other change.<br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>Fixed.</div><div><br></div><div>Thanks,</div><div>--Serge</div></div></div></div>