From: Devang Patel Date: Fri, 1 Apr 2011 19:02:33 +0000 (+0000) Subject: Do not try calculate the size of forward-declared template type array. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae503df62bde42440a9c4495d26d6142c4af7bcb;p=clang Do not try calculate the size of forward-declared template type array. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128725 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 80bec0f0ee..c7a50efcd8 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1226,6 +1226,14 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, } else if (Ty->isIncompleteArrayType()) { Size = 0; Align = CGM.getContext().getTypeAlign(Ty->getElementType()); + } else if (Ty->isDependentSizedArrayType()) { + Size = 0; + Align = 0; + } else if (Ty->getElementType()->getTypeClass() + == Type::TemplateSpecialization) { + // FIXME : Emit appropriate element type info. + Size = 0; + Align = 0; } else { // Size and align of the whole array, not the element type. Size = CGM.getContext().getTypeSize(Ty); diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp index 0ddfc242b1..8560c5a8e9 100644 --- a/test/CodeGenCXX/debug-info-template.cpp +++ b/test/CodeGenCXX/debug-info-template.cpp @@ -20,3 +20,13 @@ class TU { }; TU<2> u2; + +// PR9600 +template class vector {}; +class Foo; +typedef vector FooVector[3]; +struct Test { + virtual void foo(FooVector *); +}; +static Test test; +