]> granicus.if.org Git - clang/commitdiff
Canonicalize the types produced by template argument deduction.
authorDouglas Gregor <dgregor@apple.com>
Wed, 22 Jul 2009 20:25:36 +0000 (20:25 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 22 Jul 2009 20:25:36 +0000 (20:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76777 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateDeduction.cpp
test/SemaTemplate/temp_class_spec.cpp

index 4e6d0f4dd167b33de20c19ea3eee84f770de3023..deb5457d857773b8c82f554bb71ab6cf3e7169ba 100644 (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);
index db154f6076b4b0ec1b7ed9caa11150b3caf84051..b1053fe3cb7f3795366a59bd20b55047625c216c 100644 (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;