]> granicus.if.org Git - clang/commitdiff
Fix mismatch between pointer and pointee type when diagnosing an incorrect
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 26 Jan 2013 02:07:32 +0000 (02:07 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 26 Jan 2013 02:07:32 +0000 (02:07 +0000)
object argument type for a member call.

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

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

index e1c3d6839d1148371aca5356273f65f1ee8bea96..22cb61eda390742c5886c5d417f5d9a5d40fabb1 100644 (file)
@@ -4620,7 +4620,7 @@ static bool TryCopyInitialization(const CanQualType FromQTy,
 /// 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, QualType OrigFromType,
   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, QualType OrigFromType,
                                     != FromTypeCanon.getLocalCVRQualifiers() &&
       !ImplicitParamType.isAtLeastAsQualifiedAs(FromTypeCanon)) {
     ICS.setBad(BadConversionSequence::bad_qualifiers,
-               OrigFromType, ImplicitParamType);
+               FromType, ImplicitParamType);
     return ICS;
   }
 
index 09586201e56129bce54ca20514f2ec451a5ba025..e0f34d937f6f1989bee57c91b984058fa8058574 100644 (file)
@@ -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'}}
+}