[llvm-bugs] [Bug 24406] New: Incorrect handling of the case when different name-lookup paths gives different access in multiple inheritence

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 9 04:39:56 PDT 2015


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

            Bug ID: 24406
           Summary: Incorrect handling of the case when different
                    name-lookup paths gives different access in multiple
                    inheritence
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anders.granlund.0 at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider the following program (prog.cc):

struct A { protected: static const int x = 0; };

struct B : A {};

struct C : A { using A::x; };

struct D : B, C {};

int main() { D::x; }

Compile it with the following command line:

clang++ prog.cc -std=c++14 -pedantic-errors

The following error message is then given:


prog.cc:9:17: error: 'f' is a protected member of 'A'
int main() { D::f(); }
                ^
prog.cc:1:35: note: declared protected here
struct A { protected: static void f() {} };
                                  ^
1 error generated.


According to [class.paths]p1 (http://eel.is/c++draft/class.paths#1):

"If a name can be reached by several paths through a multiple inheritance
graph, the access is that of the path that gives most access."

So the program should be well-formed and I expected to get no error messages
therefore.

-- 
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/20150809/712c6ecd/attachment.html>


More information about the llvm-bugs mailing list