diff options
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 |