This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/58040] New: Cannot take address-of public using-declaration of member from protected base class


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58040

            Bug ID: 58040
           Summary: Cannot take address-of public using-declaration of
                    member from protected base class
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at mattwhitlock dot name

$ cat <<EOF > test.cpp
struct Base {
    void foo() { }
    void bar() { }
};

struct Derived : protected Base {
    void foo() { this->Base::foo(); }
    using Base::bar;
};

int main() {
    Derived d;
    d.foo(); // OK
    d.bar(); // OK
    d.Derived::foo(); // OK
    d.Derived::bar(); // OK
    (d.*&Derived::foo)(); // OK
    (d.*&Derived::bar)(); // error
}
EOF

$ g++-4.7.3 --version | head -n1
g++ (Gentoo 4.7.3 p1.0, pie-0.5.5) 4.7.3

$ g++-4.7.3 test.cpp
test.cpp: In function 'int main()':
test.cpp:18:19: error: 'Base' is an inaccessible base of 'Derived'

$ g++-4.8.1 --version | head -n1
g++-4.8.1 (Gentoo 4.8.1 p1.0, pie-0.5.6) 4.8.1

$ g++-4.8.1 test.cpp
test.cpp: In function 'int main()':
test.cpp:18:19: error: 'Base' is an inaccessible base of 'Derived'
     (d.*&Derived::bar)(); // error
                   ^


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]