[cfe-commits] r90950 - /cfe/trunk/lib/Sema/SemaExprCXX.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Dec 8 20:53:57 PST 2009
Author: efriedma
Date: Tue Dec 8 22:53:56 2009
New Revision: 90950
URL: http://llvm.org/viewvc/llvm-project?rev=90950&view=rev
Log:
Fix for PR5730: make sure to consistently call
PerformObjectArgumentInitialization from BuildCXXMemberCallExpr.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=90950&r1=90949&r2=90950&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Dec 8 22:53:56 2009
@@ -2176,15 +2176,13 @@
CXXMemberCallExpr *Sema::BuildCXXMemberCallExpr(Expr *Exp,
CXXMethodDecl *Method) {
+ if (PerformObjectArgumentInitialization(Exp, Method))
+ assert(0 && "Calling BuildCXXMemberCallExpr with invalid call?");
+
MemberExpr *ME =
new (Context) MemberExpr(Exp, /*IsArrow=*/false, Method,
SourceLocation(), Method->getType());
- QualType ResultType;
- if (const CXXConversionDecl *Conv = dyn_cast<CXXConversionDecl>(Method))
- ResultType = Conv->getConversionType().getNonReferenceType();
- else
- ResultType = Method->getResultType().getNonReferenceType();
-
+ QualType ResultType = Method->getResultType().getNonReferenceType();
MarkDeclarationReferenced(Exp->getLocStart(), Method);
CXXMemberCallExpr *CE =
new (Context) CXXMemberCallExpr(Context, ME, 0, 0, ResultType,
@@ -2220,11 +2218,7 @@
case CastExpr::CK_UserDefinedConversion: {
assert(!From->getType()->isPointerType() && "Arg can't have pointer type!");
-
- // Cast to base if needed.
- if (PerformObjectArgumentInitialization(From, Method))
- return ExprError();
-
+
// Create an implicit call expr that calls it.
CXXMemberCallExpr *CE = BuildCXXMemberCallExpr(From, Method);
return MaybeBindToTemporary(CE);
More information about the cfe-commits
mailing list