From ba690a4112be4f0abde48ce51d41e92c79f96f3e Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 4 Apr 2011 23:18:38 +0000 Subject: [PATCH] Incomplete type does not have any size. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128855 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 2 +- test/CodeGenCXX/debug-info-template.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index c7a50efcd8..cf147502c5 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1226,7 +1226,7 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, } else if (Ty->isIncompleteArrayType()) { Size = 0; Align = CGM.getContext().getTypeAlign(Ty->getElementType()); - } else if (Ty->isDependentSizedArrayType()) { + } else if (Ty->isDependentSizedArrayType() || Ty->isIncompleteType()) { Size = 0; Align = 0; } else if (Ty->getElementType()->getTypeClass() diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp index 8560c5a8e9..9d52159bed 100644 --- a/test/CodeGenCXX/debug-info-template.cpp +++ b/test/CodeGenCXX/debug-info-template.cpp @@ -30,3 +30,17 @@ struct Test { }; static Test test; +// PR9608 +template struct TheTemplate { + struct Empty2 {}; + typedef const Empty2 DependentType[i]; + TheTemplate() {} +}; + +class TheTemplateTest : public TheTemplate<42> { + TheTemplateTest(); + void method(const TheTemplate<42>::DependentType *) {} +}; + +TheTemplateTest::TheTemplateTest() : TheTemplate<42>() {} + -- 2.40.0