From: Douglas Gregor Date: Wed, 22 Jul 2009 20:25:36 +0000 (+0000) Subject: Canonicalize the types produced by template argument deduction. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b084a05b3546137c71bed3cdf469b85e56deac75;p=clang Canonicalize the types produced by template argument deduction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76777 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 4e6d0f4dd1..deb5457d85 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -361,7 +361,8 @@ DeduceTemplateArguments(ASTContext &Context, assert(TemplateTypeParm->getDepth() == 0 && "Can't deduce with depth > 0"); unsigned Quals = Arg.getCVRQualifiers() & ~Param.getCVRQualifiers(); - QualType DeducedType = Arg.getQualifiedType(Quals); + QualType DeducedType + = Context.getCanonicalType(Arg.getQualifiedType(Quals)); if (Deduced[Index].isNull()) Deduced[Index] = TemplateArgument(SourceLocation(), DeducedType); diff --git a/test/SemaTemplate/temp_class_spec.cpp b/test/SemaTemplate/temp_class_spec.cpp index db154f6076..b1053fe3cb 100644 --- a/test/SemaTemplate/temp_class_spec.cpp +++ b/test/SemaTemplate/temp_class_spec.cpp @@ -135,6 +135,24 @@ struct get_array_size { int array_size0[get_array_size::value == 12? 1 : -1]; +template +struct remove_extent { + typedef T type; +}; + +template +struct remove_extent { + typedef T type; +}; + +template +struct remove_extent { + typedef T type; +}; + +int remove_extent0[is_same::type, int[5]>::value? 1 : -1]; +int remove_extent1[is_same::type, const int[5]>::value? 1 : -1]; + template struct is_unary_function { static const bool value = false;