[cfe-commits] r86079 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/overload-member-call.cpp test/SemaTemplate/member-access-expr.cpp

Douglas Gregor dgregor at apple.com
Wed Nov 4 16:07:36 PST 2009


Author: dgregor
Date: Wed Nov  4 18:07:36 2009
New Revision: 86079

URL: http://llvm.org/viewvc/llvm-project?rev=86079&view=rev
Log:
Make sure to grab CVR qualifiers from the canonical type. ARGH!

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/SemaCXX/overload-member-call.cpp
    cfe/trunk/test/SemaTemplate/member-access-expr.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=86079&r1=86078&r2=86079&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Nov  4 18:07:36 2009
@@ -2097,8 +2097,8 @@
   // First check the qualifiers. We don't care about lvalue-vs-rvalue
   // with the implicit object parameter (C++ [over.match.funcs]p5).
   QualType FromTypeCanon = Context.getCanonicalType(FromType);
-  if (ImplicitParamType.getCVRQualifiers() != FromType.getCVRQualifiers() &&
-      !ImplicitParamType.isAtLeastAsQualifiedAs(FromType))
+  if (ImplicitParamType.getCVRQualifiers() != FromTypeCanon.getCVRQualifiers() &&
+      !ImplicitParamType.isAtLeastAsQualifiedAs(FromTypeCanon))
     return ICS;
 
   // Check that we have either the same type or a derived type. It

Modified: cfe/trunk/test/SemaCXX/overload-member-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-member-call.cpp?rev=86079&r1=86078&r2=86079&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/overload-member-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-member-call.cpp Wed Nov  4 18:07:36 2009
@@ -54,3 +54,15 @@
   
   X::h(0); // expected-error{{call to non-static member function without an object argument}}
 }
+
+struct X1 {
+  int& member();
+  float& member() const;
+};
+
+struct X2 : X1 { };
+
+void test_X2(X2 *x2p, const X2 *cx2p) {
+  int &ir = x2p->member();
+  float &fr = cx2p->member();
+}

Modified: cfe/trunk/test/SemaTemplate/member-access-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/member-access-expr.cpp?rev=86079&r1=86078&r2=86079&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/member-access-expr.cpp (original)
+++ cfe/trunk/test/SemaTemplate/member-access-expr.cpp Wed Nov  4 18:07:36 2009
@@ -88,3 +88,20 @@
     (void)f0<0>();
   }
 };
+
+// Fun with template instantiation and conversions
+struct X4 {
+  int& member();
+  float& member() const;
+};
+
+template<typename T>
+struct X5 {
+  void f(T* ptr) { int& ir = ptr->member(); }
+  void g(T* ptr) { float& fr = ptr->member(); }
+};
+
+void test_X5(X5<X4> x5, X5<const X4> x5c, X4 *xp, const X4 *cxp) {
+  x5.f(xp);
+  x5c.g(cxp);
+}





More information about the cfe-commits mailing list