Canonicalize the types produced by template argument deduction.

llvm-svn: 76777
This commit is contained in:
Douglas Gregor 2009-07-22 20:25:36 +00:00
parent f87fbc058d
commit 7ac44f4cfb
2 changed files with 20 additions and 1 deletions

View File

@ -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);

View File

@ -135,6 +135,24 @@ struct get_array_size<T[N]> {
int array_size0[get_array_size<int[12]>::value == 12? 1 : -1];
template<typename T>
struct remove_extent {
typedef T type;
};
template<typename T>
struct remove_extent<T[]> {
typedef T type;
};
template<typename T, unsigned N>
struct remove_extent<T[N]> {
typedef T type;
};
int remove_extent0[is_same<remove_extent<int[][5]>::type, int[5]>::value? 1 : -1];
int remove_extent1[is_same<remove_extent<const int[][5]>::type, const int[5]>::value? 1 : -1];
template<typename T>
struct is_unary_function {
static const bool value = false;