[Bug c++/64615] New: Access level check error: g++ thinks the non default ctor is protected while its public
petschy at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 15 18:02:00 GMT 2015
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);
}
More information about the Gcc-bugs
mailing list