[cfe-commits] r101133 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/overload-call.cpp

Douglas Gregor dgregor at apple.com
Tue Apr 13 08:50:40 PDT 2010


Author: dgregor
Date: Tue Apr 13 10:50:39 2010
New Revision: 101133

URL: http://llvm.org/viewvc/llvm-project?rev=101133&view=rev
Log:
When returning the result of a call to an object of class type, do not
return a NULL expression; return either an error or a proper
expression. Fixes PR6078.


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=101133&r1=101132&r2=101133&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Apr 13 10:50:39 2010
@@ -6293,7 +6293,7 @@
       
     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 @@
   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->

Modified: cfe/trunk/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=101133&r1=101132&r2=101133&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-call.cpp Tue Apr 13 10:50:39 2010
@@ -406,3 +406,18 @@
     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}}
+  }
+}





More information about the cfe-commits mailing list