<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 8, 2012, at 11:17 AM, David Blaikie wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On Wed, Feb 8, 2012 at 12:56 PM, Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>> wrote:<br><blockquote type="cite">Author: dgregor<br></blockquote><blockquote type="cite">Date: Wed Feb 8 14:56:50 2012<br></blockquote><blockquote type="cite">New Revision: 150088<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=150088&view=rev">http://llvm.org/viewvc/llvm-project?rev=150088&view=rev</a><br></blockquote><blockquote type="cite">Log:<br></blockquote><blockquote type="cite">When computing the type of a local variable reference within a lambda,<br></blockquote><blockquote type="cite">only add 'const' for variables captured by copy in potentially<br></blockquote><blockquote type="cite">evaluated expressions of non-mutable lambdas. (The "by copy" part was<br></blockquote><blockquote type="cite">missing).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified:<br></blockquote><blockquote type="cite"> cfe/trunk/lib/Sema/SemaExpr.cpp<br></blockquote><blockquote type="cite"> cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified: cfe/trunk/lib/Sema/SemaExpr.cpp<br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=150088&r1=150087&r2=150088&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=150088&r1=150087&r2=150088&view=diff</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)<br></blockquote><blockquote type="cite">+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Feb 8 14:56:50 2012<br></blockquote><blockquote type="cite">@@ -2094,6 +2094,15 @@<br></blockquote><blockquote type="cite"> return S.getCurBlock() != 0;<br></blockquote><blockquote type="cite"> }<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">+/// \brief Determine whether the given lambda would capture the given<br></blockquote><blockquote type="cite">+/// variable by copy.<br></blockquote><blockquote type="cite">+static bool willCaptureByCopy(LambdaScopeInfo *LSI, VarDecl *Var) {<br></blockquote><blockquote type="cite">+ if (LSI->isCaptured(Var))<br></blockquote><blockquote type="cite">+ return LSI->getCapture(Var).isCopyCapture();<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+ return LSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_LambdaByval;<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite"> static bool shouldAddConstQualToVarRef(ValueDecl *D, Sema &S) {<br></blockquote><blockquote type="cite"> VarDecl *var = dyn_cast<VarDecl>(D);<br></blockquote><blockquote type="cite"> if (!var)<br></blockquote><blockquote type="cite">@@ -2117,7 +2126,8 @@<br></blockquote><blockquote type="cite"> // about decltype hints that it might apply in unevaluated contexts<br></blockquote><blockquote type="cite"> // as well... and there's precent in our blocks implementation.<br></blockquote><blockquote type="cite"> return !LSI->Mutable &&<br></blockquote><blockquote type="cite">- S.ExprEvalContexts.back().Context != Sema::Unevaluated;<br></blockquote><blockquote type="cite">+ S.ExprEvalContexts.back().Context != Sema::Unevaluated &&<br></blockquote><blockquote type="cite">+ willCaptureByCopy(LSI, var);<br></blockquote><blockquote type="cite"> }<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> static ExprResult BuildBlockDeclRefExpr(Sema &S, ValueDecl *VD,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp<br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp?rev=150088&r1=150087&r2=150088&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp?rev=150088&r1=150087&r2=150088&view=diff</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp (original)<br></blockquote><blockquote type="cite">+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp Wed Feb 8 14:56:50 2012<br></blockquote><blockquote type="cite">@@ -6,7 +6,40 @@<br></blockquote><blockquote type="cite"> // expected-error{{lambda expressions are not supported yet}}<br></blockquote><blockquote type="cite"> }<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-// FIXME: Also check translation of captured vars to data members,<br></blockquote><blockquote type="cite">-// most of which isn't in the AST.<br></blockquote><blockquote type="cite">+// Check that we get the right types of captured variables (the semantic-analysis part of<br></blockquote><br>Did part of this comment go missing?<font class="Apple-style-span" color="#007329"><br></font></div></blockquote><br></div><div>Committee meetings are bad for continuous trains of thought... r150090.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div><div><br></div><br></body></html>