diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 5 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/debug-info-template-array.cpp | 14 |
2 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 00555674f0f..379d1585a5d 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1468,7 +1468,10 @@ llvm::DIType CGDebugInfo::CreateType(const ArrayType *Ty, 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/clang/test/CodeGenCXX/debug-info-template-array.cpp b/clang/test/CodeGenCXX/debug-info-template-array.cpp new file mode 100644 index 00000000000..305327bbe09 --- /dev/null +++ b/clang/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>[]>(); +} |

