Skip to content

Protected friend function in parent class will not compile #20060

@llvmbot

Description

@llvmbot
Bugzilla Link 19686
Version 3.4
OS MacOS X
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

Steps to Reproduce:
Compile the following code:

    class A {
    protected:
        void ProtectedMemberFunc() {}
    };

    class B : public A {
        friend void A::ProtectedMemberFunc();
    };

Expected result:
The code compiles without error.

Actual result:
The following error is raised:

main.cpp:8:20: error: friend function 'ProtectedMemberFunc' is a protected member of 'A'
    friend void A::ProtectedMemberFunc();
                ~~~^
main.cpp:8:20: note: must name member using the type of the current context 'B'

Additional Notes:
Exact version: Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Similar to bug http://llvm.org/bugs/show_bug.cgi?id=6840

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compiler on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions