[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579 Jason Merrill jason at gcc dot gnu.org changed: What|Removed |Added Known to fail|| --- Comment #10 from Jason Merrill jason at gcc dot gnu.org --- Note that this will be broken again in 4.9.4 and 5.3, because the fix caused the worse bug 66957 and so I reverted it on those branches. 6.0 will have a proper fix.
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #7 from jason at gcc dot gnu dot org 2009-01-16 18:35 --- Subject: Bug 38579 Author: jason Date: Fri Jan 16 18:35:28 2009 New Revision: 143439 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=143439 Log: PR c++/38579 * search.c (protected_accessible_p): N doesn't vary. Added: trunk/gcc/testsuite/g++.dg/conversion/access1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/search.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #8 from jason at gcc dot gnu dot org 2009-01-16 18:55 --- Fixed for 4.4, not applying to older branches. -- jason at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #9 from jason at gcc dot gnu dot org 2009-01-16 18:58 --- *** Bug 35640 has been marked as a duplicate of this bug. *** -- jason at gcc dot gnu dot org changed: What|Removed |Added CC||mrs at apple dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[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
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #5 from jason at gcc dot gnu dot org 2009-01-16 06:17 --- Ah yes, I see. The bug is not with the visibility of the copy ctor, but with the conversion from B to P in order to call it. -- jason at gcc dot gnu dot org changed: What|Removed |Added Known to fail|4.3.0 4.0.0 4.4.0 |3.4.6 4.3.0 4.0.0 4.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #6 from jason at gcc dot gnu dot org 2009-01-16 06:41 --- This bug was introduced by the fix for PR 10990. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
-- jason at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org |dot org | Status|REOPENED|ASSIGNED Last reconfirmed|2008-12-21 23:10:28 |2009-01-16 06:42:05 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #2 from jason at gcc dot gnu dot org 2009-01-14 16:37 --- 11.2: If a class is declared to be a base class for another class using the protected access specifier, the public and protected members of the base class are accessible as protected members of the derived class. Not a bug. -- jason at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[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) {} }; templateclass P struct BugGcc0 : protected P //public P { BugGcc0() {} }; templateclass P struct BugGcc1 : public P { BugGcc1() {} templateclass P1 BugGcc1(const BugGcc0P1 t) : P(t) {} }; void foo() { BugGcc0Policy d0; BugGcc1Policy 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
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Priority|P3 |P2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
-- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||pinskia at gcc dot gnu dot ||org Keywords||accepts-invalid Known to fail||4.3.0 4.0.0 4.4.0 Known to work||3.3 Summary|Template: Wrong inherited |[4.2/4.3/4.4 Regression] |copy-ctor visibility|Template: Wrong inherited ||copy-ctor visibility Target Milestone|--- |4.2.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579
[Bug c++/38579] [4.2/4.3/4.4 Regression] Template: Wrong inherited copy-ctor visibility
--- Comment #1 from pinskia at gcc dot gnu dot org 2008-12-21 23:10 --- Confirmed, related to PR 26693. Here is the correct testcase (the testcase below does not compile with 4.4 but for a different reason than the real bug): struct Policy { protected: Policy() {} Policy(const Policy) {} }; templateint I, class P struct BugGcc : protected P //public P { BugGcc() {} templateint I1, class P1 BugGcc(const BugGccI1, P1 t) : P(t) {} }; void foo() { BugGcc0, Policy f1; BugGcc1, Policy f2(f1); } -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2008-12-21 23:10:28 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38579