[LLVMbugs] [Bug 12788] New: protected anonymous union member not visible in derived class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 10 12:26:36 PDT 2012


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

             Bug #: 12788
           Summary: protected anonymous union member not visible in
                    derived class
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clang at martinien.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following test program throws a compile error:

---
class A
{
public:
    union {
        const char* ptr1;
    };
protected:
    union {
        const char* ptr2;
    };
};

class B: public A
{
public:
    void f()
    {
        A::ptr1 = 0;  // works
        A::ptr2 = 0;  // doesn't work
    }
};
---

/tmp/prot_access.cpp:19:12: error: 'ptr2' is a protected member of 'A'
        A::ptr2 = 0;  // doesn't work
           ^
/tmp/prot_access.cpp:9:21: note: must name member using the type of the current
context 'B'
        const char* ptr2;
                    ^


The protected union member of the base class is not visible in B, but should
be.

clang version 3.2 (trunk 156545)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
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