If we don't have a complete type for the array type yet either then
just let the alignment be zero.

PR13531

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161379 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 0055567..379d158 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -1468,7 +1468,10 @@
       CGM.getContext().getTypeAlign(CGM.getContext().getBaseElementType(VAT));
   } else if (Ty->isIncompleteArrayType()) {
     Size = 0;
-    Align = CGM.getContext().getTypeAlign(Ty->getElementType());
+    if (Ty->getElementType()->isIncompleteType())
+      Align = 0;
+    else
+      Align = CGM.getContext().getTypeAlign(Ty->getElementType());
   } else if (Ty->isDependentSizedArrayType() || Ty->isIncompleteType()) {
     Size = 0;
     Align = 0;
diff --git a/test/CodeGenCXX/debug-info-template-array.cpp b/test/CodeGenCXX/debug-info-template-array.cpp
new file mode 100644
index 0000000..305327b
--- /dev/null
+++ b/test/CodeGenCXX/debug-info-template-array.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang -emit-llvm -g -S %s -o -
+// PR13531
+template <typename>
+struct unique_ptr {
+  unique_ptr() {}
+};
+
+template <unsigned>
+struct Vertex {};
+
+void crash() // Asserts
+{
+  unique_ptr<Vertex<2>[]> v = unique_ptr<Vertex<2>[]>();
+}