summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateDeduction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateDeduction.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index ac4e4b9b28c..4e6d0f4dd16 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -341,6 +341,14 @@ DeduceTemplateArguments(ASTContext &Context,
= Param->getAsTemplateTypeParmType()) {
unsigned Index = TemplateTypeParm->getIndex();
+ // If the argument type is an array type, move the qualifiers up to the
+ // top level, so they can be matched with the qualifiers on the parameter.
+ // FIXME: address spaces, ObjC GC qualifiers
+ QualType ArgElementType = Arg;
+ while (const ArrayType *ArgArray = ArgElementType->getAs<ArrayType>())
+ ArgElementType = ArgArray->getElementType();
+ Arg = Arg.getWithAdditionalQualifiers(ArgElementType.getCVRQualifiers());
+
// The argument type can not be less qualified than the parameter
// type.
if (Param.isMoreQualifiedThan(Arg) && !(TDF & TDF_IgnoreQualifiers)) {
OpenPOWER on IntegriCloud