<div dir="ltr"><div><div>+def ext_retained_language_linkage : Extension<</div><div>+  "friend function %0 retaining previous language linkage is an extension">,</div><div>+  InGroup<DiagGroup<"retained-language-linkage">>;</div>
</div><div><br></div><div>I'd like this diagnostic to be clearer that</div><div><br></div><div>  extern "C" void f();</div><div>  struct S {</div><div>    friend void f();</div><div>  };</div><div><br></div>
<div>is fine but</div><div><br></div><div>  extern "C" void f();</div><div>  extern "C++" {</div><div>    struct S {</div><div>      friend void f();</div><div>    };</div><div>  }</div><div><br></div>
<div>is the extension. Maybe add a note pointing at the innermost surrounding linkage specification that we're ignoring?</div><div><br></div><div><br></div><div>+      // The friend object kind isn't yet complete so check IDNS directly.</div>
<div>+      if (New->getIdentifierNamespace() & Decl::IDNS_OrdinaryFriend) {</div><div><br></div><div>We don't care whether it's FOK_Declared or FOK_Undeclared, so why not:</div><div><br></div><div>  if (New->getFriendObjectKind() != FOK_None) {</div>
<div><br></div><div>?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 22, 2013 at 10:46 AM, Alp Toker <span dir="ltr"><<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Richard,<br>
<br>
With this patch, friend function declarations will retain the language<br>
linkage specified for previous declarations instead of emitting an error<br>
diagnostic.<br>
<br>
The feature is known to be compatible with GCC and MSVC and permits a<br>
language to be specified indirectly where it cannot otherwise be written<br>
directly in class scope.<br>
<br>
Further to the previous patch, this feature is now a clang extension so<br>
warnings can be enabled/disabled with a -Wretained-language-linkage flag<br>
while we seek clarifications to the language standard. Tests have been<br>
moved to SemaCXX/linkage-spec.cpp.<br>
<span class="HOEnZb"><font color="#888888"><br>
Alp.<br>
<br>
--<br>
<a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
the browser experts<br>
<br>
</font></span></blockquote></div><br></div>