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 #3 from syntheticpp at gmx dot net  2009-01-14 18:29 -------
11.2 is talking about a different case.

When you instantiate the integer template parameter manually you will see that
it is really a bug:

struct Policy
{
protected:
    Policy() {}
    Policy(const Policy&) {}
};


template<class P>
struct BugGcc0 :
        protected P
        //public P
{
    BugGcc0() {}
};


template<class P>
struct BugGcc1 : public P
{
    BugGcc1() {}

    template<class P1>
    BugGcc1(const BugGcc0<P1>& t) : P(t) {}
};

void foo()
{
    BugGcc0<Policy> d0;
    BugGcc1<Policy> d1(d0);
}


The Policy ctor is visible within BugGcc1 (because it is inherited protected)
but it is not visible to a different class (again, because it is inherited
protected).

BugGcc0 and BugGcc1 only have the same base class but they are NOT of same type
which 11.2 talks about.

The protected policy ctor is only visible for BugGcc0 but not for BugGcc1.


-- 

syntheticpp at gmx dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |syntheticpp at gmx dot net
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


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]