[llvm-bugs] [Bug 35055] New: friend declaration in derived class does not get honored

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 24 04:50:14 PDT 2017


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

            Bug ID: 35055
           Summary: friend declaration in derived class does not get
                    honored
           Product: clang
           Version: 5.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: John.Tytgat at esko.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The following produces a ".... is a protected member of..." error while the
friend declaration in the derived class is honored by gcc (multiple versions
upto trunk), Visual Studio (multiple versions upto VS2017) and ICC.

Are they all wrongly accepting this code, or is this a Clang only issue ?

--8<--
class AFriend;

class Foo
{
        protected:
                static void Bar();
};

#if 1
class DerivedFoo
:       public Foo
{
        friend class AFriend;
};
#endif

class AFriend
{
        public:
                void CallFooBar()
                {
                        Foo::Bar();
                }
};
--8<--

-- 
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/20171024/413ff627/attachment.html>


More information about the llvm-bugs mailing list