diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-07-24 05:54:19 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-07-24 05:54:19 +0000 |
commit | 16a74704c9e7cebcdba819befa5dfab75fab9259 (patch) | |
tree | 977aca7f29826127668034ee01376e54db984e6f /clang/lib/AST/ASTContext.cpp | |
parent | b7d8563973fe5970509d526c73697feb1081c4c2 (diff) | |
download | bcm5719-llvm-16a74704c9e7cebcdba819befa5dfab75fab9259.tar.gz bcm5719-llvm-16a74704c9e7cebcdba819befa5dfab75fab9259.zip |
[AST] Perform additional canonicalization for DependentSizedArrayType
We treated DependentSizedArrayTypes with the same element type but
differing size expressions as equivalently canonical. This would lead
to bizarre behavior during template instantiation.
This fixes PR24212.
llvm-svn: 243093
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 61bd1077941..ba4bcbc488c 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2759,9 +2759,10 @@ QualType ASTContext::getDependentSizedArrayType(QualType elementType, QualType canon = getQualifiedType(QualType(canonTy,0), canonElementType.Quals); - // If we didn't need extra canonicalization for the element type, - // then just use that as our result. - if (QualType(canonElementType.Ty, 0) == elementType) + // If we didn't need extra canonicalization for the element type or the size + // expression, then just use that as our result. + if (QualType(canonElementType.Ty, 0) == elementType && + canonTy->getSizeExpr() == numElements) return canon; // Otherwise, we need to build a type which follows the spelling |