]> granicus.if.org Git - clang/commitdiff
When returning the result of a call to an object of class type, do not
authorDouglas Gregor <dgregor@apple.com>
Tue, 13 Apr 2010 15:50:39 +0000 (15:50 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 13 Apr 2010 15:50:39 +0000 (15:50 +0000)
return a NULL expression; return either an error or a proper
expression. Fixes PR6078.

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

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

index cfc8068b96ca3207221f5d9381af29e58437227a..40d48e3cc6c5868367e2b50836b936dca079b995 100644 (file)
@@ -6293,7 +6293,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
       
     return ActOnCallExpr(S, ExprArg(*this, CE), LParenLoc,
                          MultiExprArg(*this, (ExprTy**)Args, NumArgs),
-                         CommaLocs, RParenLoc).release();
+                         CommaLocs, RParenLoc).result();
   }
 
   CheckMemberOperatorAccess(LParenLoc, Object, 0, Best->FoundDecl);
@@ -6397,7 +6397,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
   if (CheckFunctionCall(Method, TheCall.get()))
     return true;
 
-  return MaybeBindToTemporary(TheCall.release()).release();
+  return MaybeBindToTemporary(TheCall.release()).result();
 }
 
 /// BuildOverloadedArrowExpr - Build a call to an overloaded @c operator->
index c286028c29af7b038df99615b8efba307d185ce0..f3a5fba8e6df4b46585d811a99adb14fdee6e4d0 100644 (file)
@@ -406,3 +406,18 @@ namespace PR6483 {
     f1(x1); // expected-error{{no matching function for call}}
   }  
 }
+
+namespace PR6078 {
+  struct A { // expected-note{{candidate is the implicit copy constructor}}
+    A(short); // expected-note{{candidate constructor}}
+    A(long); // expected-note{{candidate constructor}}
+  };
+  struct S {
+    typedef void ft(A);
+    operator ft*();
+  };
+
+  void f() {
+    S()(0); // expected-error{{conversion from 'int' to 'PR6078::A' is ambiguous}}
+  }
+}