From: Douglas Gregor Date: Sat, 10 Mar 2012 00:29:33 +0000 (+0000) Subject: Qualifiers on a canonical array type go on the outermost type, not the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db762ef262987403b4e2a3bb8d5762277306a224;p=clang Qualifiers on a canonical array type go on the outermost type, not the innermost type. Fixes PR12142. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152456 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 7434f0f8d7..22b145c59a 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -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(CFromTy)) - CFromTy = CFromTy->getAs()->getElementType(); - while (isa(CToTy)) - CToTy = CFromTy->getAs()->getElementType(); - Qualifiers FromQs = CFromTy.getQualifiers(); Qualifiers ToQs = CToTy.getQualifiers(); diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 913d13f99b..1cfe068a12 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -563,3 +563,8 @@ namespace IncompleteArg { Consumer c; int n = sizeof(c(make())); } + +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'}} +}