This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
- From: "syntheticpp at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jan 2009 18:56:24 -0000
- Subject: [Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
- References: <bug-38579-13410@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from syntheticpp at gmx dot net 2009-01-15 18:56 -------
It has nothing to do with templates.
This code still compiles:
struct P
{
protected:
P() {}
P(const P&) {}
};
struct B : protected P
{
B() {}
};
struct C : public P
{
C(const B& b) : P(b) {}
};
void foo()
{
B b;
C c(b);
//P p(b); // <-- compiler error
}
But I it should not, because only within the scope of B
B "is a" P. Globally B "is not a" P. Therefore you can't pass
a instance of B in a scope different to B to the constructor
of P.
Even when C inherits from P the struct B is still "not a" P
in the scope of C.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579