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: http://review.tizen.org/git/?a=commitdiff_plain;h=7ac44f4cfb4ddf9940e8e3ec0bfd20f31bde3dfa;p=platform%2Fupstream%2Fllvm.git Canonicalize the types produced by template argument deduction. llvm-svn: 76777 --- diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 4e6d0f4..deb5457 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/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/clang/test/SemaTemplate/temp_class_spec.cpp b/clang/test/SemaTemplate/temp_class_spec.cpp index db154f6..b1053fe 100644 --- a/clang/test/SemaTemplate/temp_class_spec.cpp +++ b/clang/test/SemaTemplate/temp_class_spec.cpp @@ -136,6 +136,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; };