<div dir="ltr">Hi All,<div><br></div><div>I am trying to fix the above mentioned assertion for a failing gcc testcase.</div><div>g++.dg/c++0x/variadic103.cpp testcase ( attached )</div><div><br></div><div>Patch added is as follows in TemplateDeclInstantiator::VisitVarDecl function of SemaTemplateInstantiateDecl.cpp</div>
<div><br></div><div>For the above testcases an error should be thrown for incomplete types having an initializer with zero elements.</div><div><br></div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">if (!DI)</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px"> return 0;</span><br style="font-family:arial,sans-serif;font-size:13px"><br style="font-family:arial,sans-serif;font-size:13px"><font color="#000000"><span style="font-family:arial,sans-serif;font-size:13px">+ Expr* Arg= D->getInit();</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">+ InitListExpr *ILE = dyn_cast<InitListExpr>(Arg);</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">+ if(!ILE || (ILE && ILE->getNumInits() == 0 )) {</span></font><div class="im" style="font-family:arial,sans-serif;font-size:13px">
<font color="#000000">+ if (DI->getType()->isIncompleteType() || DI->getType()->isIncompleteOrObjectType() ) {<br>+ if (SemaRef.RequireCompleteType(D->getLocation(), DI->getType(), <br></font></div>
<div class="im" style="font-family:arial,sans-serif;font-size:13px"><font color="#000000">+ diag::err_typecheck_incomplete_array_needs_initializer)) {<br>+ D->setInvalidDecl();<br>+ return 0;<br>+ }<br>
+ }<br></font></div><font color="#000000"><span style="font-family:arial,sans-serif;font-size:13px">+ }</span><br style="font-family:arial,sans-serif;font-size:13px"></font></div><div><font color="#000000"><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></font></div><div><font color="#000000"><span style="font-family:arial,sans-serif;font-size:13px"><br></span></font></div><div><font color="#000000" face="arial, sans-serif">With above code, there is a diagnostic thrown for </font>g++.dg/c++0x/variadic103.cpp testcase as expected and the "Assertion Failure (!isIncompleteType() && "This doesn't make sense for incomplete types"); for int [] type " is resolved, however some other assertion in isa_impl_cl occurs while running clang regression on c++ googletests file ( gtest-all.cc )</div>
<div><br></div><div>Appreciate any inputs on this for me to proceed further.</div><div><br></div><div>Thanks.</div><div>- Jyoti <br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div>