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(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
bugreport.zip (693 KB)