[cfe-commits] r173554 - Fix mismatch between pointer and pointee type when diagnosing an incorrect

Richard Smith richard-llvm at metafoo.co.uk
Fri Jan 25 18:07:32 PST 2013


Author: rsmith
Date: Fri Jan 25 20:07:32 2013
New Revision: 173554

URL: http://llvm.org/viewvc/llvm-project?rev=173554&view=rev
Log:
Fix mismatch between pointer and pointee type when diagnosing an incorrect
object argument type for a member call.

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

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=173554&r1=173553&r2=173554&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Jan 25 20:07:32 2013
@@ -4620,7 +4620,7 @@ static bool TryCopyInitialization(const 
 /// parameter of the given member function (@c Method) from the
 /// expression @p From.
 static ImplicitConversionSequence
-TryObjectArgumentInitialization(Sema &S, QualType OrigFromType,
+TryObjectArgumentInitialization(Sema &S, QualType FromType,
                                 Expr::Classification FromClassification,
                                 CXXMethodDecl *Method,
                                 CXXRecordDecl *ActingContext) {
@@ -4636,7 +4636,6 @@ TryObjectArgumentInitialization(Sema &S,
   ImplicitConversionSequence ICS;
 
   // We need to have an object of class type.
-  QualType FromType = OrigFromType;
   if (const PointerType *PT = FromType->getAs<PointerType>()) {
     FromType = PT->getPointeeType();
 
@@ -4671,7 +4670,7 @@ TryObjectArgumentInitialization(Sema &S,
                                     != FromTypeCanon.getLocalCVRQualifiers() &&
       !ImplicitParamType.isAtLeastAsQualifiedAs(FromTypeCanon)) {
     ICS.setBad(BadConversionSequence::bad_qualifiers,
-               OrigFromType, ImplicitParamType);
+               FromType, ImplicitParamType);
     return ICS;
   }
 

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=173554&r1=173553&r2=173554&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-member-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-member-call.cpp Fri Jan 25 20:07:32 2013
@@ -105,3 +105,11 @@ namespace test1 {
   }
 }
 
+namespace b7398190 {
+  struct S {
+    int f(); // expected-note {{'this' argument has type 'const b7398190::S', but method is not marked const}}
+    void f(int); // expected-note {{requires 1 argument, but 0 were provided}}
+  };
+  const S *p;
+  int k = p->f(); // expected-error {{no matching member function for call to 'f'}}
+}





More information about the cfe-commits mailing list