[LLVMbugs] [Bug 6840] New: Friend class cannot access protected field of parent

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 14 16:59:53 PDT 2010


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

           Summary: Friend class cannot access protected field of parent
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ori at avtalion.name
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following code compiles in g++, but not in clang++

class A {
protected:
    static int a;
};

class B : public A {
    friend class C;
};

class C {
    void foo() { 
        A::a = 0;
    }
};


$ clang++ -c a.cpp
a.cpp:12:6: error: 'a' is a protected member of 'A'
                A::a = 0;
                   ^
a.cpp:3:13: note: declared protected here
        static int a;
                   ^
1 error generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list