<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 8, 2009, at 7:53 PM, Douglas Gregor wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi James,<div><br><div><div>On Jul 6, 2009, at 9:27 PM, James Porter wrote:</div></div><div><blockquote type="cite"><div>Index: lib/Parse/ParseExpr.cpp<br>===================================================================<br>--- lib/Parse/ParseExpr.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 74890)<br>+++ lib/Parse/ParseExpr.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)<br>@@ -915,6 +915,14 @@<br> tok::TokenKind OpKind = Tok.getKind();<br> SourceLocation OpLoc = ConsumeToken(); // Eat the "." or "->" token.<br><br>+ CXXScopeSpec SS;<br>+ if (getLang().CPlusPlus) {<br>+ if( !Actions.ActOnCXXEnterMemberScope(CurScope,LHS) )<br>+ return ExprError();<br>+ ParseOptionalCXXScopeSpecifier(SS);<br>+ Actions.ActOnCXXExitMemberScope(CurScope,LHS,SS);<br>+ }<br>+<br></div></blockquote><div><br></div><div>Oh, this is interesting. I completely expected to have something like:</div><div><br></div><div><br></div><blockquote type="cite"><div>+ CXXScopeSpec SS;<br>+ if (getLang().CPlusPlus) {<br>+ if( !Actions.ActOnCXXEnterMemberScope(CurScope,LHS) )<br>+ return ExprError();<br>+ ParseOptionalCXXScopeSpecifier(SS);</div></blockquote><div><br></div>followed by a call to ActOnMemberReferenceExpr, then</div><div><br></div><div> if (getLang().CPlusPlus)</div><div> Actions.ActOnCXXExitMemberScope(CurScope,LHS,SS);</div><div><br></div><div>In other words, I expected that we would enter the member scope, process the member-reference expression within that scope (so that name lookup would be based on that scope), then exit the member scope at the end. \</div></div></div></blockquote></div><div><br></div><div>Thinking about this further, I think you had the right idea after all. At least, I can see both ways working, and they need to produce the same results. The really, really tricky case is with a conversion function, e.g., x.operator T(). C++ [basic.lookup.classref]p7 says this:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-style-span" style="font-family: Times; font-size: 10px; ">If the <i>id-expression </i>is a <i>conversion-function-id</i>, its <i>conversion-type-id </i>shall denote the same type in both the context in which the entire <i>postfix-expression </i>occurs and in the context of the class of the object expression (or the class pointed to by the pointer expression).</span></div><br><div>Since the conversion-function-id is the only place where I could imagine your approach and my suggestion to differ, and in theory we have to do *both*, let's go with your approach: it requires fewer changes, and we can think about diagnosing paragraph 7 later.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div></body></html>