[llvm-bugs] [Bug 44531] clang-cl unqualified friend declaration

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 13 10:00:19 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44531

Reid Kleckner <rnk at google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |rnk at google.com
         Resolution|---                         |INVALID

--- Comment #1 from Reid Kleckner <rnk at google.com> ---
The intention of the warning is to indicate that, on Linux, you are not
friending the global class S, but you are declaring a class N::S, which will
friend N::SS. MSVC will instead friend class ::S, and clang-cl does this.
Consider:

https://godbolt.org/z/yZbeVt

class S;

namespace N
{
    class SS
    {
        friend class S;
        static int gv;
    };
}

class S {
  int usePriv() { return N::SS::gv; }
};

MSVC and clang-cl accept, regular clang on Linux rejects. Clang on Windows is
trying to warn you about that non-standard behavior. Seems to be working as
intended.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200113/758636ae/attachment.html>


More information about the llvm-bugs mailing list