[PATCH] PR17337 - Retain previous linkage of friend function declarations

Alp Toker alp at nuanti.com
Tue Sep 24 09:14:21 PDT 2013


gcc and MSVC both intentionally* retain the language linkage, and they
accept both test cases in the PR.

I already explained in PR17337 why this special handling is important,
and it becomes more so in the face of nested language linkage
specifications:

  http://llvm.org/bugs/show_bug.cgi?id=17337

The previous release of clang correctly accepted the code, just like
every other C++ compiler, up until checking was added in r171139 /
r181163 so this is a recent rejects-valid regression.

clang r171139 states "The language linkage of redeclarations must match.
GCC was already reporting an error for this."

If you don't feel comfortable reviewing this patch could you give others
a chance to take a look instead of marking the PR Invalid?

* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41020




On 24/09/2013 14:43, Richard Smith wrote:
> On Tue, Sep 24, 2013 at 3:00 AM, Alp Toker <alp at nuanti.com
> <mailto:alp at nuanti.com>> wrote:
>
>     The previous language linkage needs to be retained as described in
>     [class.friend]p3 otherwise valid friend redeclarations differing
>     only in
>     lexical linkage are rejected.
>
>
> [class.friend]p3 says the previous linkage (internal/external/no
> linkage) is retained, not the previous language linkage. Our current
> behavior appears to be correct here.
>  
>
>     Fixes PR17337.
>
>     --
>     http://www.nuanti.com
>     the browser experts
>
>
>     _______________________________________________
>     cfe-commits mailing list
>     cfe-commits at cs.uiuc.edu <mailto:cfe-commits at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>

-- 
http://www.nuanti.com
the browser experts

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130924/0d3cd9a6/attachment.html>


More information about the cfe-commits mailing list