[cfe-dev] Assertion Failure (!isIncompleteType() && "This doesn't make sense for incomplete types"); for int [] type

Jyoti jyoti.yalamanchili at gmail.com
Mon Oct 7 06:05:25 PDT 2013


Hi All,

I am trying to fix the above mentioned assertion for a failing gcc testcase.
g++.dg/c++0x/variadic103.cpp testcase ( attached )

Patch added is as follows in TemplateDeclInstantiator::VisitVarDecl
function of  SemaTemplateInstantiateDecl.cpp

For the above testcases an error should be thrown for incomplete types
having an initializer with zero elements.


if (!DI)
    return 0;

+ Expr* Arg= D->getInit();
+  InitListExpr *ILE = dyn_cast<InitListExpr>(Arg);
+  if(!ILE || (ILE && ILE->getNumInits() == 0 )) {
+    if (DI->getType()->isIncompleteType() ||
DI->getType()->isIncompleteOrObjectType() ) {
+      if (SemaRef.RequireCompleteType(D->getLocation(), DI->getType(),
+ diag::err_typecheck_incomplete_array_needs_initializer)) {
+        D->setInvalidDecl();
+       return 0;
+      }
+    }
+ }


With above code, there is a diagnostic thrown for 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 )

Appreciate any inputs on this for me to proceed further.

Thanks.
- Jyoti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131007/85d2f241/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bugreport.zip
Type: application/zip
Size: 709916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131007/85d2f241/attachment.zip>


More information about the cfe-dev mailing list