From 7ea66742467916bb7695c87b5cf835d4b3bf5e16 Mon Sep 17 00:00:00 2001 From: Vassil Vassilev <vvasilev@cern.ch> Date: Tue, 21 May 2013 14:59:37 +0200 Subject: [PATCH] In cases of a = dep->Call(), we still need to visit the RHS, even if it was auto candidate. --- interpreter/cling/lib/Interpreter/DynamicLookup.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/interpreter/cling/lib/Interpreter/DynamicLookup.cpp b/interpreter/cling/lib/Interpreter/DynamicLookup.cpp index 486f2abe5df..6d9bc478db4 100644 --- a/interpreter/cling/lib/Interpreter/DynamicLookup.cpp +++ b/interpreter/cling/lib/Interpreter/DynamicLookup.cpp @@ -512,6 +512,9 @@ namespace cling { } ASTNodeInfo EvaluateTSynthesizer::VisitBinaryOperator(BinaryOperator* Node) { + ASTNodeInfo rhs = Visit(Node->getRHS()); + ASTNodeInfo lhs; + if (const DeclRefExpr* DRE = dyn_cast<DeclRefExpr>(Node->getLHS())) { const Decl* D = DRE->getDecl(); if (const AnnotateAttr* A = D->getAttr<AnnotateAttr>()) @@ -519,16 +522,15 @@ namespace cling { return ASTNodeInfo(Node, /*needs eval*/false); } - ASTNodeInfo rhs = Visit(Node->getRHS()); - ASTNodeInfo lhs = Visit(Node->getLHS()); + lhs = Visit(Node->getLHS()); + assert((lhs.hasSingleNode() || rhs.hasSingleNode()) && "1:N replacements are not implemented yet!"); // Try find out the type of the left-hand-side of the operator // and give the hint to the right-hand-side in order to replace the // dependent symbol - if (Node->isAssignmentOp() && - rhs.isForReplacement() && + if (Node->isAssignmentOp() && rhs.isForReplacement() && !lhs.isForReplacement()) { if (Expr* LHSExpr = lhs.getAs<Expr>()) if (!IsArtificiallyDependent(LHSExpr)) { -- GitLab