]> granicus.if.org Git - clang/commitdiff
Qualifiers on a canonical array type go on the outermost type, not the
authorDouglas Gregor <dgregor@apple.com>
Sat, 10 Mar 2012 00:29:33 +0000 (00:29 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sat, 10 Mar 2012 00:29:33 +0000 (00:29 +0000)
innermost type. Fixes PR12142.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152456 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/SemaCXX/overload-call.cpp

index 7434f0f8d7477d59f7ad46eae70ae711ec4bc75b..22b145c59a1ca5daeac4e22e7792ca0b3ce9a3d3 100644 (file)
@@ -7847,12 +7847,6 @@ void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, unsigned I) {
 
   if (CToTy.getUnqualifiedType() == CFromTy.getUnqualifiedType() &&
       !CToTy.isAtLeastAsQualifiedAs(CFromTy)) {
-    // It is dumb that we have to do this here.
-    while (isa<ArrayType>(CFromTy))
-      CFromTy = CFromTy->getAs<ArrayType>()->getElementType();
-    while (isa<ArrayType>(CToTy))
-      CToTy = CFromTy->getAs<ArrayType>()->getElementType();
-
     Qualifiers FromQs = CFromTy.getQualifiers();
     Qualifiers ToQs = CToTy.getQualifiers();
 
index 913d13f99b8726c0b87c234ab5197a72a9c90163..1cfe068a123c36164714a9fce94dc333af7057f9 100644 (file)
@@ -563,3 +563,8 @@ namespace IncompleteArg {
   Consumer c;
   int n = sizeof(c(make<int()>()));
 }
+
+namespace PR12142 {
+  void fun(int (*x)[10]); // expected-note{{candidate function not viable: 1st argument ('const int (*)[10]') would lose const qualifier}}
+  void g() { fun((const int(*)[10])0); } // expected-error{{no matching function for call to 'fun'}}
+}