jyoti.yalamanchili added you to the CC list for the revision "Assertion when 
incomplete array type is used as template param".

Hi dblaikie, rsmith,

Hello,

Following assertion occurs for the test code mentioned below. 

assert(!isIncompleteType() && "This doesn't make sense for incomplete types");

Test code :-
// { dg-options "-std=c++0x" }
template<class T>
T&& create();
template<class T, class... Args>
void test() {
  T t(create<Args>()...);       // { dg-error "incomplete" }
  (void) t;
}
int main() {
  test<int[]>();
}


since int[] is incomplete type, it is not valid to call isConstantSizeType() on 
such types.

I have added a check to prevent checking constant size if type is incomplete 
array type, as incomplete types do not have known constant size.
let me know your review comments.

Thanks.

http://llvm-reviews.chandlerc.com/D1700

Files:
  CGDecl.cpp

Index: CGDecl.cpp
===================================================================
--- CGDecl.cpp
+++ CGDecl.cpp
@@ -839,7 +839,7 @@
     EmitVariablyModifiedType(Ty);
 
   llvm::Value *DeclPtr;
-  if (Ty->isConstantSizeType()) {
+  if (!Ty->isIncompleteArrayType() && Ty->isConstantSizeType()) {
     bool NRVO = getLangOpts().ElideConstructors &&
       D.isNRVOVariable();
Index: CGDecl.cpp
===================================================================
--- CGDecl.cpp
+++ CGDecl.cpp
@@ -839,7 +839,7 @@
     EmitVariablyModifiedType(Ty);
 
   llvm::Value *DeclPtr;
-  if (Ty->isConstantSizeType()) {
+  if (!Ty->isIncompleteArrayType() && Ty->isConstantSizeType()) {
     bool NRVO = getLangOpts().ElideConstructors &&
       D.isNRVOVariable();
 
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to