<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 14 April 2014 11:59, Ben Langmuir <span dir="ltr"><<a href="mailto:blangmuir@apple.com" target="_blank">blangmuir@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div style="word-wrap:break-word"><br><div><div class=""><div>On Apr 14, 2014, at 11:53 AM, Nick Lewycky <<a href="mailto:nlewycky@google.com" target="_blank">nlewycky@google.com</a>> wrote:</div><br><blockquote type="cite">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 14 April 2014 11:21, Ben Langmuir <span dir="ltr"><<a href="mailto:blangmuir@apple.com" target="_blank">blangmuir@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



Author: benlangmuir<br>
Date: Mon Apr 14 13:21:04 2014<br>
New Revision: 206202<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=206202&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=206202&view=rev</a><br>
Log:<br>
Add clang:: qualifier back to Module<br>
<br>
Apparently this was required by some compilers.<br></blockquote><div><br></div><div>I don't believe this fix is correct, I think the code is still invalid even if it happens to compile, since it's still changing the meaning of the name "Module" inside a class scope.</div>

</div></div></div></blockquote><div><br></div></div><div>Fair enough. I’ll take a look at renaming this later if no one beats me to it.  I just wanted to make sure it built for the time being.</div></div></div></blockquote>

<div><br></div><div>Richard pointed out to me offline that your fix is indeed correct, but it's not entirely clear me to me how fragile that fact is. In particular, it's okay to create such a conflict (where the name means two different things) as long as no name lookup is performed on that name. After the class is complete (before delayed parsing), the name lookup on "Module" will simply find the variable and not the type.</div>

<div><br></div><div>So this is okay:</div><div>struct X { clang::Module *Module; };</div><div><br></div><div>and so is this, in the sense that it's a clear error both clang and gcc diagnose:</div><div><div>struct X { clang::Module *Module; Module *M; }; // second Module is a use of the variable name, never the type<br>

</div></div><div><br></div><div>Nick</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">

<div><div class=""><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">The compilers which issued these errors were certainly correct, I've filed PR19427 for clang to detect this some day.</div>

<div class="gmail_quote"><br></div><div class="gmail_quote">Nick<br><div> </div>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Modified:<br>
    cfe/trunk/include/clang/Frontend/FrontendActions.h<br>
<br>
Modified: cfe/trunk/include/clang/Frontend/FrontendActions.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendActions.h?rev=206202&r1=206201&r2=206202&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendActions.h?rev=206202&r1=206201&r2=206202&view=diff</a><br>





==============================================================================<br>
--- cfe/trunk/include/clang/Frontend/FrontendActions.h (original)<br>
+++ cfe/trunk/include/clang/Frontend/FrontendActions.h Mon Apr 14 13:21:04 2014<br>
@@ -93,7 +93,7 @@ public:<br>
 };<br>
<br>
 class GenerateModuleAction : public ASTFrontendAction {<br>
-  Module *Module;<br>
+  clang::Module *Module;<br>
   const FileEntry *ModuleMapForUniquing;<br>
   bool IsSystem;<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div>
</blockquote></div></div><br></div></blockquote></div></div></div>