[cfe-commits] r152456 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/overload-call.cpp
Douglas Gregor
dgregor at apple.com
Fri Mar 9 16:29:33 PST 2012
Author: dgregor
Date: Fri Mar 9 18:29:33 2012
New Revision: 152456
URL: http://llvm.org/viewvc/llvm-project?rev=152456&view=rev
Log:
Qualifiers on a canonical array type go on the outermost type, not the
innermost type. Fixes PR12142.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/overload-call.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=152456&r1=152455&r2=152456&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Mar 9 18:29:33 2012
@@ -7847,12 +7847,6 @@
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();
Modified: cfe/trunk/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=152456&r1=152455&r2=152456&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-call.cpp Fri Mar 9 18:29:33 2012
@@ -563,3 +563,8 @@
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'}}
+}
More information about the cfe-commits
mailing list