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++/64615] New: Access level check error: g++ thinks the non default ctor is protected while its public


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64615

            Bug ID: 64615
           Summary: Access level check error: g++ thinks the non default
                    ctor is protected while its public
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: petschy at gmail dot com

Access level is changed from protected (base class) to public (derived class)
via using declaration. The default ctor and the two overloaded member functions
are accessible, however the non-default ctor is not, g++ complains that it's
protected.

g++ 4.9 and 5.0 (20150115) give the same error messages.
cmdline:
g++-5.0.0 -Wall -std=c++11 20150115-using_base_ctor.cpp

----8<---8<---8<---8<---
class B
{
protected:
        B() { }
        B(int) { }
        void Foo() { }
        void Foo(int) { }
};
class D : public B
{
public:
        using B::B;
        using B::Foo;
};
void d_ctor()
{
        D d;
}
void d_ctor2()
{
        D d(0); // !
}
void d_foo(D* d)
{
        d->Foo();
}
void d_foo2(D* d)
{
        d->Foo(0);
}


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