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++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility



------- 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


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